Image decoding method and device therefor

ABSTRACT

According to the disclosure of the present document, weight index information for sub-block merge candidates of a current block can be derived and coding efficiency can be increased.

This is a Bypass of PCT Application No. PCT/KR2020/008107, with an international filing date of Jun. 24, 2020, which claims the benefit of U.S. Provisional Application No. 62/865,964, filed on Jun. 24, 2019, all of which are incorporated by reference in their entirety herein.

BACKGROUND OF THE DISCLOSURE Field of the Disclosure

The present disclosure relates to an image decoding method and an apparatus therefor.

Related Art

Recently, the demand for high resolution, high quality image/video such as 4K, 8K or more Ultra High Definition (UHD) image/video is increasing in various fields. As the image/video resolution or quality becomes higher, relatively more amount of information or bits are transmitted than for conventional image/video data. Therefore, if image/video data are transmitted via a medium such as an existing wired/wireless broadband line or stored in a legacy storage medium, costs for transmission and storage are readily increased.

Moreover, interests and demand are growing for virtual reality (VR) and artificial reality (AR) contents, and immersive media such as hologram; and broadcasting of images/videos exhibiting image/video characteristics different from those of an actual image/video, such as game images/videos, are also growing.

Therefore, a highly efficient image/video compression technique is required to effectively compress and transmit, store, or play high resolution, high quality images/videos showing various characteristics as described above.

SUMMARY

The present disclosure provides a method and an apparatus for increasing image coding efficiency.

The present disclosure also provides a method and an apparatus for deriving weight index information for bi-prediction in inter prediction.

The present disclosure also provides a method and an apparatus for deriving weight index information for an affine merge candidate.

In one aspect of the present document, an image decoding method performed by a decoding apparatus is provided. The method includes obtaining image information comprising inter prediction mode information and residual information through a bitstream, generating residual samples based on the residual information, generating a merge candidate list for a current block based on the inter prediction mode information, selecting one candidate from among candidates included in the merge candidate list, generating L0 prediction samples and L1 prediction samples of the current block based on the selected candidate, generating prediction samples by weighted averaging the L0 prediction samples and the L1 prediction samples based on weight index information for the selected candidate, and generating reconstructed samples based on the prediction samples and the residual samples. The candidates include an affine merge candidate. The affine merge candidate includes at least one of CPMV0 for a control point CP0, CPMV1 for a control point CP1, and CPMV2 for a control point CP2. The CPMV0 is derived based on a top-left neighboring block of the current block, a first left neighboring block adjacent to a bottom side of the top-left neighboring block, or a first top neighboring block adjacent to a right side of the top-left neighboring block. The CPMV1 is derived based on a top-right neighboring block of the current block or a second top neighboring block adjacent to a left side of the top-right neighboring block. The CPMV2 is derived based on a bottom-left neighboring block of the current block or a second left neighboring block adjacent to a top side of the bottom-left neighboring block. When the affine merge candidate comprises the CPMV0, weight index information for the affine merge candidate is derived based on weight index information for the CP0.

In another aspect of the present disclosure, an image encoding method performed by an encoding apparatus is provided. The image encoding method includes determining an inter prediction mode of a current block and generating inter prediction mode information indicating the inter prediction mode, generating a merge candidate list for the current block based on the inter prediction mode, generating selection information indicating one candidate among candidates included in the merge candidate list, generating residual information based on residual samples of the current block, and encoding image information comprising the inter prediction mode information, the selection information, and the residual information. The candidates include an affine merge candidate. The affine merge candidate includes at least one of CPMV0 for a control point CP0, CPMV1 for a control point CP1, and CPMV2 for a control point CP2. The CPMV0 is derived based on a top-left neighboring block of the current block, a first left neighboring block adjacent to a bottom side of the top-left neighboring block, or a first top neighboring block adjacent to a right side of the top-left neighboring block. The CPMV1 is derived based on a top-right neighboring block of the current block or a second top neighboring block adjacent to a left side of the top-right neighboring block. The CPMV2 is derived based on a bottom-left neighboring block of the current block or a second left neighboring block adjacent to a top side of the bottom-left neighboring block. When the affine merge candidate comprises the CPMV0, weight index information for the affine merge candidate is indicated based on weight index information for the CP0.

In yet another aspect of the present disclosure, a computer-readable storage medium that stores encoded information causing an image decoding apparatus to implement an image decoding method is provided. The image decoding method includes obtaining image information comprising inter prediction mode information and residual information through a bitstream, generating residual samples based on the residual information, generating a merge candidate list for a current block based on the inter prediction mode information, selecting one candidate from among candidates included in the merge candidate list, generating L0 prediction samples and L1 prediction samples of the current block based on the selected candidate, generating prediction samples by weighted averaging the L0 prediction samples and the L1 prediction samples based on weight index information for the selected candidate, and generating reconstructed samples based on the prediction samples and the residual samples. The candidates include an affine merge candidate. The affine merge candidate includes at least one of CPMV0 for a control point CP0, CPMV1 for a control point CP1, and CPMV2 for a control point CP2. The CPMV0 is derived based on a top-left neighboring block of the current block, a first left neighboring block adjacent to a bottom side of the top-left neighboring block, or a first top neighboring block adjacent to a right side of the top-left neighboring block. The CPMV1 is derived based on a top-right neighboring block of the current block or a second top neighboring block adjacent to a left side of the top-right neighboring block. The CPMV2 is derived based on a bottom-left neighboring block of the current block or a second left neighboring block adjacent to a top side of the bottom-left neighboring block. When the affine merge candidate comprises the CPMV0, weight index information for the affine merge candidate is derived based on weight index information for the CP0.

According to the present disclosure, it is possible to increase the overall image/video compression efficiency.

According to the present, it is possible to efficiently construct motion vector candidates during inter-prediction.

According to the present disclosure, it is possible to efficiently perform weight-based bi-prediction.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram schematically illustrating an example of a video/image coding system to which embodiments of the present disclosure may be applied.

FIG. 2 is a diagram schematically illustrating a configuration of a video/image encoding apparatus to which embodiments of the present disclosure may be applied.

FIG. 3 is a diagram schematically illustrating a configuration of a video/image decoding apparatus to which embodiments of the present disclosure may be applied.

FIG. 4 is a diagram illustrating an example of a video/image encoding method based on inter prediction.

FIG. 5 is a diagram schematically illustrating an inter predictor in an encoding apparatus.

FIG. 6 is a diagram illustrating an example of a video/image decoding method based on inter prediction.

FIG. 7 is a diagram schematically illustrating an inter predictor in a decoding apparatus.

FIG. 8 is a diagram for explaining a merge mode in inter prediction.

FIGS. 9A and 9B are diagrams illustrating an example of CPMV for affine motion prediction.

FIG. 10 is a diagram exemplarily illustrating a case in which an affine MVF is determined on the unit basis of a subblock.

FIG. 11 is a diagram for explaining an affine merge mode in inter prediction.

FIG. 12 is a diagram for explaining positions of candidates in an affine merge mode.

FIG. 13 is a diagram for explaining sub-block-based temporal motion vector prediction (SbTMVP) in inter prediction.

FIG. 14 is a diagram illustrating control points for a constructed affine merge candidate.

FIGS. 15 and 16 are diagrams schematically illustrating an example of a video/image encoding method and related components according to an embodiment(s) of present disclosure.

FIGS. 17 and 18 are diagrams schematically illustrating an example of an image/video decoding method and related components according to an embodiment(s) of present disclosure.

FIG. 19 is a diagram illustrating an example of a content streaming system to which embodiments disclosed in present disclosure may be applied.

DESCRIPTION OF EXEMPLARY EMBODIMENTS

The disclosure of the present document may be modified in various forms, and specific embodiments thereof will be described and illustrated in the drawings. However, the embodiments are not intended for limiting the disclosure. The terms used in the following description are used to merely describe specific embodiments, but are not intended to limit the embodiment of the present document. An expression of a singular number includes an expression of the plural number, so long as it is clearly read differently. The terms such as “include” and “have” are intended to indicate that features, numbers, steps, operations, elements, components, or combinations thereof used in the present document exist and it should be thus understood that the possibility of existence or addition of one or more different features, numbers, steps, operations, elements, components, or combinations thereof is not excluded.

In addition, each configuration of the drawings described in this document is an independent illustration for explaining functions as features that are different from each other, and does not mean that each configuration is implemented by mutually different hardware or different software. For example, two or more of the configurations can be combined to form one configuration, and one configuration can also be divided into multiple configurations. Embodiments in which configurations are combined and/or separated are included in the scope of the disclosure of the present document.

This document relates to video/image coding. For example, methods/embodiments disclosed in this document may be related to the versatile video coding (VVC) standard. In addition the method/embodiment disclosed in the present document may be related to the essential video coding (EVC) standard, AOMedia video 1 (AV1) standard, 2nd generation of audio video coding standard (AVS2) or the next-generation video/image coding standard (e.g., H.267 or H.268 etc)

This document suggests various embodiments of video/image coding, and the above embodiments may also be performed in combination with each other unless otherwise specified.

Hereinafter, embodiments of the present document will be described with reference to the accompanying drawings. Hereinafter, the same reference numerals may be used for the same components in the drawings, and repeated descriptions of the same components may be omitted.

FIG. 1 illustrates an example of a video/image coding system to which the embodiments of the present disclosure may be applied.

Referring to FIG. 1, a video/image coding system may include a first device (a source device) and a second device (a reception device). The source device may transmit encoded video/image information or data to the reception device through a digital storage medium or network in the form of a file or streaming.

The source device may include a video source, an encoding apparatus, and a transmitter. The receiving device may include a receiver, a decoding apparatus, and a renderer. The encoding apparatus may be called a video/image encoding apparatus, and the decoding apparatus may be called a video/image decoding apparatus. The transmitter may be included in the encoding apparatus. The receiver may be included in the decoding apparatus. The renderer may include a display, and the display may be configured as a separate device or an external component.

The video source may acquire video/image through a process of capturing, synthesizing, or generating the video/image. The video source may include a video/image capture device and/or a video/image generating device. The video/image capture device may include, for example, one or more cameras, video/image archives including previously captured video/images, and the like. The video/image generating device may include, for example, computers, tablets and smartphones, and may (electronically) generate video/images. For example, a virtual video/image may be generated through a computer or the like. In this case, the video/image capturing process may be replaced by a process of generating related data.

The encoding apparatus may encode input video/image. The encoding apparatus may perform a series of procedures such as prediction, transform, and quantization for compaction and coding efficiency. The encoded data (encoded video/image information) may be output in the form of a bitstream.

The transmitter may transmit the encoded image/image information or data output in the form of a bitstream to the receiver of the receiving device through a digital storage medium or a network in the form of a file or streaming. The digital storage medium may include various storage mediums such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, and the like. The transmitter may include an element for generating a media file through a predetermined file format and may include an element for transmission through a broadcast/communication network. The receiver may receive/extract the bitstream and transmit the received bitstream to the decoding apparatus.

The decoding apparatus may decode the video/image by performing a series of procedures such as dequantization, inverse transform, and prediction corresponding to the operation of the encoding apparatus.

The renderer may render the decoded video/image. The rendered video/image may be displayed through the display.

The present disclosure relates to video/image coding. For example, the method/embodiment disclosed in the present disclosure may be applied to the methods disclosed in a versatile video coding (VVC) standard, an essential video coding (EVC) standard, an AOMedia Video 1 (AV1) standard, 2nd generation of audio video coding standard (AVS2), or a next-generation video/image coding standard (ex. H.267 or H.268, etc).

This document suggests various embodiments of video/image coding, and the above embodiments may also be performed in combination with each other unless otherwise specified.

In this document, a video may refer to a series of images over time. A picture generally refers to the unit representing one image at a particular time frame, and a slice/tile refers to the unit constituting a part of the picture in terms of coding. A slice/tile may include one or more coding tree units (CTUs). One picture may consist of one or more slices/tiles.

A tile is a rectangular region of CTUs within a particular tile column and a particular tile row in a picture. The tile column is a rectangular region of CTUs having a height equal to the height of the picture and a width specified by syntax elements in the picture parameter set. The tile row is a rectangular region of CTUs having a height specified by syntax elements in the picture parameter set and a width equal to the width of the picture. A tile scan is a specific sequential ordering of CTUs partitioning a picture in which the CTUs are ordered consecutively in CTU raster scan in a tile whereas tiles in a picture are ordered consecutively in a raster scan of the tiles of the picture. A slice may comprise a number of complete tiles or a number of consecutive CTU rows in one tile of a picture that may be contained in one NAL unit. In this document, tile group and slice can be used interchangeably. For example, in this document, a tile group/tile group header may be referred to as a slice/slice header.

Meanwhile, one picture may be divided into two or more subpictures. The subpicture may be a rectangular region of one or more slices within a picture.

A pixel or a pel may mean a smallest unit constituting one picture (or image). Also, ‘sample’ may be used as a term corresponding to a pixel. A sample may generally represent a pixel or a value of a pixel, and may represent only a pixel/pixel value of a luma component or only a pixel/pixel value of a chroma component.

A unit may represent a basic unit of image processing. The unit may include at least one of a specific region of the picture and information related to the region. One unit may include one luma block and two chroma (ex. cb, cr) blocks. The unit may be used interchangeably with terms such as block or area in some cases. In a general case, an M×N block may include samples (or sample arrays) or a set (or array) of transform coefficients of M columns and N rows. Alternatively, the sample may mean a pixel value in the spatial domain, and when such a pixel value is transformed to the frequency domain, it may mean a transform coefficient in the frequency domain.

In this document, the term “A or B” may mean “only A”, “only B” or “both A and B.”. In other words, “A or B” in this document may be interpreted as “A and/or B.” For instance, should be interpreted to indicate “and/or.” For example, in this document “A, B or C” may mean “only A”, “only B”, “only C”, or “any combination of A, B and C.”

In this document, the term “/” and “,” may mean “and/or.” For instance, the expression “A/B” may mean “A and/or B.” Accordingly, “A/B” may mean “only A”, “only B”, or “both A and B.” For example, “A, B, C” may mean “A, B, or C.”

In the present document, “at least one of A and B” may mean “only A”, “only B”, or “both A and B”. Further, in the present document, the expression “at least one of A or B” or “at least one of A and/or B” may be interpreted the same as “at least one of A and B”.

Further, in the present document, “at least one of A, B and C” may mean “only A”, “only B”, “only C”, or “any combination of A, B and C”. Further, “at least one of A, B or C” or “at least one of A, B and/or C” may mean “at least one of A, B and C”.

Further, the parentheses used in the present document may mean “for example”. Specifically, in the case that “prediction (intra prediction)” is expressed, it may be indicated that “intra prediction” is proposed as an example of “prediction”. In other words, the term “prediction” in the present document is not limited to “intra prediction”, and it may be indicated that “intra prediction” is proposed as an example of “prediction”. Further, even in the case that “prediction (i.e., intra prediction)” is expressed, it may be indicated that “intra prediction” is proposed as an example of “prediction”.

In the present document, technical features individually explained in one drawing may be individually implemented, or may be simultaneously implemented.

FIG. 2 is a diagram schematically illustrating the configuration of a video/image encoding apparatus to which the disclosure of the present document may be applied. Hereinafter, what is referred to as the video encoding apparatus may include an image encoding apparatus.

Referring to FIG. 2, the encoding apparatus 200 may include and be configured with an image partitioner 210, a predictor 220, a residual processor 230, an entropy encoder 240, an adder 250, a filter 260, and a memory 270. The predictor 220 may include an inter predictor 221 and an intra predictor 222. The residual processor 230 may include a transformer 232, a quantizer 233, a dequantizer 234, and an inverse transformer 235. The residual processor 230 may further include a subtractor 231. The adder 250 may be called a reconstructor or reconstructed block generator. The image partitioner 210, the predictor 220, the residual processor 230, the entropy encoder 240, the adder 250, and the filter 260, which have been described above, may be configured by one or more hardware components (e.g., encoder chipsets or processors) according to an embodiment. In addition, the memory 270 may include a decoded picture buffer (DPB), and may also be configured by a digital storage medium. The hardware component may further include the memory 270 as an internal/external component.

The image partitioner 210 may split an input image (or, picture, frame) input to the encoding apparatus 200 into one or more processing units. As an example, the processing unit may be called a coding unit (CU). In this case, the coding unit may be recursively split according to a Quad-tree binary-tree ternary-tree (QTBTTT) structure from a coding tree unit (CTU) or the largest coding unit (LCU). For example, one coding unit may be split into a plurality of coding units of a deeper depth based on a quad-tree structure, a binary-tree structure, and/or a ternary-tree structure. In this case, for example, the quad-tree structure is first applied and the binary-tree structure and/or the ternary-tree structure may be later applied. Alternatively, the binary-tree structure may also be first applied. A coding procedure according to the present disclosure may be performed based on a final coding unit which is not split any more. In this case, based on coding efficiency according to image characteristics or the like, the maximum coding unit may be directly used as the final coding unit, or as necessary, the coding unit may be recursively split into coding units of a deeper depth, such that a coding unit having an optimal size may be used as the final coding unit. Here, the coding procedure may include a procedure such as prediction, transform, and reconstruction to be described later. As another example, the processing unit may further include a predictor (PU) or a transform unit (TU). In this case, each of the predictor and the transform unit may be split or partitioned from the aforementioned final coding unit. The predictor may be a unit of sample prediction, and the transform unit may be a unit for inducing a transform coefficient and/or a unit for inducing a residual signal from the transform coefficient.

The unit may be interchangeably used with the term such as a block or an area in some cases. Generally, an M×N block may represent samples composed of M columns and N rows or a group of transform coefficients. The sample may generally represent a pixel or a value of the pixel, and may also represent only the pixel/pixel value of a luma component, and also represent only the pixel/pixel value of a chroma component. The sample may be used as the term corresponding to a pixel or a pel configuring one picture (or image).

The encoding apparatus 200 may subtract the prediction signal (predicted block, prediction sample array) output from the inter predictor 221 or the intra predictor 222 from the input image signal (original block, original sample array) to generate a residual signal (residual block, residual sample array), and the generated residual signal is transmitted to the transformer 232. In this case, as illustrated, a unit for subtracting the prediction signal (prediction block, prediction sample array) from an input image signal (original block, original sample array) in the encoder 200 may be referred to as a subtractor 231. The predictor may perform prediction on a processing target block (hereinafter, referred to as a current block) and generate a predicted block including prediction samples for the current block. The predictor may determine whether intra prediction or inter prediction is applied in units of a current block or CU. The predictor may generate various information on prediction, such as prediction mode information, and transmit the generated information to the entropy encoder 240, as is described below in the description of each prediction mode. The information on prediction may be encoded by the entropy encoder 240 and output in the form of a bitstream.

The intra predictor 222 may predict a current block with reference to samples within a current picture. The referenced samples may be located neighboring to the current block, or may also be located away from the current block according to the prediction mode. The prediction modes in the intra prediction may include a plurality of non-directional modes and a plurality of directional modes. The non-directional mode may include, for example, a DC mode or a planar mode. The directional mode may include, for example, 33 directional prediction modes or 65 directional prediction modes according to the fine degree of the prediction direction. However, this is illustrative and the directional prediction modes which are more or less than the above number may be used according to the setting. The intra predictor 222 may also determine the prediction mode applied to the current block using the prediction mode applied to the neighboring block.

The inter predictor 221 may induce a predicted block of the current block based on a reference block (reference sample array) specified by a motion vector on a reference picture. At this time, in order to decrease the amount of motion information transmitted in the inter prediction mode, the motion information may be predicted in units of a block, a sub-block, or a sample based on the correlation of the motion information between the neighboring block and the current block. The motion information may include a motion vector and a reference picture index. The motion information may further include inter prediction direction (L0 prediction, L1 prediction, Bi prediction, or the like) information. In the case of the inter prediction, the neighboring block may include a spatial neighboring block existing within the current picture and a temporal neighboring block existing in the reference picture. The reference picture including the reference block and the reference picture including the temporal neighboring block may also be the same as each other, and may also be different from each other. The temporal neighboring block may be called the name such as a collocated reference block, a collocated CU (colCU), or the like, and the reference picture including the temporal neighboring block may also be called a collocated picture (colPic). For example, the inter predictor 221 may configure a motion information candidate list based on the neighboring blocks, and generate information indicating what candidate is used to derive the motion vector and/or the reference picture index of the current block. The inter prediction may be performed based on various prediction modes, and for example, in the case of a skip mode and a merge mode, the inter predictor 221 may use the motion information of the neighboring block as the motion information of the current block. In the case of the skip mode, the residual signal may not be transmitted unlike the merge mode. A motion vector prediction (MVP) mode may indicate the motion vector of the current block by using the motion vector of the neighboring block as a motion vector predictor, and signaling a motion vector difference.

The predictor 220 may generate a prediction signal based on various prediction methods to be described below. For example, the predictor may apply intra prediction or inter prediction for prediction of one block and may simultaneously apply intra prediction and inter prediction. This may be called combined inter and intra prediction (CIIP). In addition, the predictor may be based on an intra block copy (IBC) prediction mode or based on a palette mode for prediction of a block. The IBC prediction mode or the palette mode may be used for image/video coding of content such as games, for example, screen content coding (SCC). IBC basically performs prediction within the current picture, but may be performed similarly to inter prediction in that a reference block is derived within the current picture. That is, IBC may use at least one of the inter prediction techniques described in this document. The palette mode may be viewed as an example of intra coding or intra prediction. When the palette mode is applied, a sample value in the picture may be signaled based on information on the palette table and the palette index.

The prediction signal generated by the predictor (including the inter predictor 221 and/or the intra predictor 222) may be used to generate a reconstructed signal or may be used to generate a residual signal. The transformer 232 may generate transform coefficients by applying a transform technique to the residual signal. For example, the transform technique may include at least one of a discrete cosine transform (DCT), a discrete sine transform (DST), a Karhunen-Loeve Transform (KLT), a graph-based transform (GBT), or a conditionally non-linear transform (CNT). Here, GBT refers to transformation obtained from a graph when expressing relationship information between pixels in the graph. CNT refers to transformation obtained based on a prediction signal generated using all previously reconstructed pixels. Also, the transformation process may be applied to a block of pixels having the same size as a square or may be applied to a block of a variable size that is not a square.

The quantizer 233 quantizes the transform coefficients and transmits the same to the entropy encoder 240, and the entropy encoder 240 encodes the quantized signal (information on the quantized transform coefficients) and outputs the encoded signal as a bitstream. Information on the quantized transform coefficients may be referred to as residual information. The quantizer 233 may rearrange the quantized transform coefficients in the block form into a one-dimensional vector form based on a coefficient scan order and may generate information on the transform coefficients based on the quantized transform coefficients in the one-dimensional vector form. The entropy encoder 240 may perform various encoding methods such as, for example, exponential Golomb, context-adaptive rvaiable length coding (CAVLC), and context-adaptive binary arithmetic coding (CABAC). The entropy encoder 240 may encode information necessary for video/image reconstruction (e.g., values of syntax elements, etc.) other than the quantized transform coefficients together or separately. Encoded information (e.g., encoded video/image information) may be transmitted or stored in units of a network abstraction layer (NAL) unit in the form of a bitstream. The video/image information may further include information on various parameter sets, such as an adaptation parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). Also, the video/image information may further include general constraint information. In this document, information and/or syntax elements transmitted/signaled from the encoding apparatus to the decoding apparatus may be included in video/image information. The video/image information may be encoded through the encoding procedure described above and included in the bitstream. The bitstream may be transmitted through a network or may be stored in a digital storage medium. Here, the network may include a broadcasting network and/or a communication network, and the digital storage medium may include various storage media such as USB, SD, CD, DVD, Blu-ray, HDD, and SSD. A transmitter (not shown) and/or a storage unit (not shown) for transmitting or storing a signal output from the entropy encoder 240 may be configured as internal/external elements of the encoding apparatus 200, or the transmitter may be included in the entropy encoder 240.

The quantized transform coefficients output from the quantizer 233 may be used to generate a prediction signal. For example, the residual signal (residual block or residual samples) may be reconstructed by applying dequantization and inverse transform to the quantized transform coefficients through the dequantizer 234 and the inverse transform unit 235. The adder 250 may add the reconstructed residual signal to the prediction signal output from the inter predictor 221 or the intra predictor 222 to generate a reconstructed signal (reconstructed picture, reconstructed block, reconstructed sample array). When there is no residual for the processing target block, such as when the skip mode is applied, the predicted block may be used as a reconstructed block. The adder 250 may be referred to as a reconstructor or a reconstruction block generator. The generated reconstructed signal may be used for intra prediction of a next processing target block in the current picture, or may be used for inter prediction of the next picture after being filtered as described below.

Meanwhile, luma mapping with chroma scaling (LMCS) may be applied during a picture encoding and/or reconstruction process.

The filter 260 may improve subjective/objective image quality by applying filtering to the reconstructed signal. For example, the filter 260 may generate a modified reconstructed picture by applying various filtering methods to the reconstructed picture, and store the modified reconstructed picture in the memory 270, specifically, in a DPB of the memory 270. The various filtering methods may include, for example, deblocking filtering, a sample adaptive offset, an adaptive loop filter, a bilateral filter, and the like. The filter 260 may generate various kinds of information related to the filtering, and transfer the generated information to the entropy encoder 240 as described later in the description of each filtering method. The information related to the filtering may be encoded by the entropy encoder 240 and output in the form of a bitstream.

The modified reconstructed picture transmitted to the memory 270 may be used as a reference picture in the inter predictor 221. When the inter prediction is applied through the encoding apparatus, prediction mismatch between the encoding apparatus 200 and the decoding apparatus can be avoided and encoding efficiency can be improved.

The DPB of the memory 270 may store the modified reconstructed picture for use as the reference picture in the inter predictor 221. The memory 270 may store motion information of a block from which the motion information in the current picture is derived (or encoded) and/or motion information of blocks in the picture, having already been reconstructed. The stored motion information may be transferred to the inter predictor 221 to be utilized as motion information of the spatial neighboring block or motion information of the temporal neighboring block. The memory 270 may store reconstructed samples of reconstructed blocks in the current picture, and may transfer the reconstructed samples to the intra predictor 222.

Meanwhile, in this document, at least one of quantization/dequantization and/or transform/inverse transform may be omitted. When the quantization/dequantization is omitted, the quantized transform coefficient may be referred to as a transform coefficient. When the transform/inverse transform is omitted, the transform coefficient may be called a coefficient or a residual coefficient or may still be called the transform coefficient for uniformity of expression.

Further, in this document, the quantized transform coefficient and the transform coefficient may be referred to as a transform coefficient and a scaled transform coefficient, respectively. In this case, the residual information may include information on transform coefficient(s), and the information on the transform coefficient(s) may be signaled through residual coding syntax. Transform coefficients may be derived based on the residual information (or information on the transform coefficient(s)), and scaled transform coefficients may be derived through inverse transform (scaling) on the transform coefficients. Residual samples may be derived based on inverse transform (transform) of the scaled transform coefficients. This may be applied/expressed in other parts of this document as well.

FIG. 3 is a diagram for schematically explaining the configuration of a video/image decoding apparatus to which the disclosure of the present document may be applied.

Referring to FIG. 3, the decoding apparatus 300 may include and configured with an entropy decoder 310, a residual processor 320, a predictor 330, an adder 340, a filter 350, and a memory 360. The predictor 330 may include an intra predictor 331 and an inter predictor 332. The residual processor 320 may include a dequantizer 321 and an inverse transformer 322. The entropy decoder 310, the residual processor 320, the predictor 330, the adder 340, and the filter 350, which have been described above, may be configured by one or more hardware components (e.g., decoder chipsets or processors) according to an embodiment. Further, the memory 360 may include a decoded picture buffer (DPB), and may be configured by a digital storage medium. The hardware component may further include the memory 360 as an internal/external component.

When the bitstream including the video/image information is input, the decoding apparatus 300 may reconstruct the image in response to a process in which the video/image information is processed in the encoding apparatus illustrated in FIG. 2. For example, the decoding apparatus 300 may derive the units/blocks based on block split-related information acquired from the bitstream. The decoding apparatus 300 may perform decoding using the processing unit applied to the encoding apparatus. Therefore, the processing unit for the decoding may be, for example, a coding unit, and the coding unit may be split according to the quad-tree structure, the binary-tree structure, and/or the ternary-tree structure from the coding tree unit or the maximum coding unit. One or more transform units may be derived from the coding unit. In addition, the reconstructed image signal decoded and output through the decoding apparatus 300 may be reproduced through a reproducing apparatus.

The decoding apparatus 300 may receive a signal output from the encoding apparatus of FIG. 2 in the form of a bitstream, and the received signal may be decoded through the entropy decoder 310. For example, the entropy decoder 310 may parse the bitstream to derive information (e.g., video/image information) necessary for image reconstruction (or picture reconstruction). The video/image information may further include information on various parameter sets such as an adaptation parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). In addition, the video/image information may further include general constraint information. The decoding apparatus may further decode picture based on the information on the parameter set and/or the general constraint information. Signaled/received information and/or syntax elements described later in this document may be decoded may decode the decoding procedure and obtained from the bitstream. For example, the entropy decoder 310 decodes the information in the bitstream based on a coding method such as exponential Golomb coding, context-adaptive variable length coding (CAVLC), or context-adaptive arithmetic coding (CABAC), and output syntax elements required for image reconstruction and quantized values of transform coefficients for residual. More specifically, the CABAC entropy decoding method may receive a bin corresponding to each syntax element in the bitstream, determine a context model by using a decoding target syntax element information, decoding information of a decoding target block or information of a symbol/bin decoded in a previous stage, and perform an arithmetic decoding on the bin by predicting a probability of occurrence of a bin according to the determined context model, and generate a symbol corresponding to the value of each syntax element. In this case, the CABAC entropy decoding method may update the context model by using the information of the decoded symbol/bin for a context model of a next symbol/bin after determining the context model. The information related to the prediction among the information decoded by the entropy decoder 310 may be provided to the predictor (inter predictor 332 and intra predictor 331), and residual values on which the entropy decoding has been performed in the entropy decoder 310, that is, the quantized transform coefficients and related parameter information, may be input to the residual processor 320.

The dequantizer 321 may dequantize the quantized transform coefficients to output the transform coefficients. The dequantizer 321 may rearrange the quantized transform coefficients in a two-dimensional block form. In this case, the rearrangement may be performed based on a coefficient scan order performed by the encoding apparatus. The dequantizer 321 may perform dequantization for the quantized transform coefficients using a quantization parameter (e.g., quantization step size information), and acquire the transform coefficients.

The inverse transformer 322 inversely transforms the transform coefficients to acquire the residual signal (residual block, residual sample array).

The predictor 330 may perform the prediction of the current block, and generate a predicted block including the prediction samples of the current block. The predictor may determine whether the intra prediction is applied or the inter prediction is applied to the current block based on the information about prediction output from the entropy decoder 310, and determine a specific intra/inter prediction mode.

The predictor 330 may generate a prediction signal based on various prediction methods to be described later. For example, the predictor may apply intra prediction or inter prediction for prediction of one block, and may simultaneously apply intra prediction and inter prediction. This may be called combined inter and intra prediction (CIIP). In addition, the predictor may be based on an intra block copy (IBC) prediction mode or based on a palette mode for prediction of a block. The IBC prediction mode or the palette mode may be used for image/video coding of content such as games, for example, screen content coding (SCC). IBC may basically perform prediction within the current picture, but may be performed similarly to inter prediction in that a reference block is derived within the current picture. That is, IBC may use at least one of the inter prediction techniques described in this document. The palette mode may be considered as an example of intra coding or intra prediction. When the palette mode is applied, information on the palette table and the palette index may be included in the video/image information and signaled.

The intra predictor 331 may predict the current block by referring to the samples in the current picture. The referred samples may be located in the neighborhood of the current block, or may be located apart from the current block according to the prediction mode. In intra prediction, prediction modes may include a plurality of non-directional modes and a plurality of directional modes. The intra predictor 331 may determine the prediction mode to be applied to the current block by using the prediction mode applied to the neighboring block.

The inter predictor 332 may derive a predicted block for the current block based on a reference block (reference sample array) specified by a motion vector on a reference picture. In this case, in order to reduce the amount of motion information being transmitted in the inter prediction mode, motion information may be predicted in the unit of blocks, subblocks, or samples based on correlation of motion information between the neighboring block and the current block. The motion information may include a motion vector and a reference picture index. The motion information may further include information on inter prediction direction (L0 prediction, L1 prediction, Bi prediction, and the like). In case of inter prediction, the neighboring block may include a spatial neighboring block existing in the current picture and a temporal neighboring block existing in the reference picture. For example, the inter predictor 332 may construct a motion information candidate list based on neighboring blocks, and derive a motion vector of the current block and/or a reference picture index based on the received candidate selection information. Inter prediction may be performed based on various prediction modes, and the information on the prediction may include information indicating a mode of inter prediction for the current block.

The adder 340 may generate a reconstructed signal (reconstructed picture, reconstructed block, or reconstructed sample array) by adding the obtained residual signal to the prediction signal (predicted block or predicted sample array) output from the predictor (including inter predictor 332 and/or intra predictor 331). If there is no residual for the processing target block, such as a case that a skip mode is applied, the predicted block may be used as the reconstructed block.

The adder 340 may be called a reconstructor or a reconstructed block generator. The generated reconstructed signal may be used for the intra prediction of a next block to be processed in the current picture, and as described later, may also be output through filtering or may also be used for the inter prediction of a next picture.

Meanwhile, a luma mapping with chroma scaling (LMCS) may also be applied in the picture decoding process.

The filter 350 may improve subjective/objective image quality by applying filtering to the reconstructed signal. For example, the filter 350 may generate a modified reconstructed picture by applying various filtering methods to the reconstructed picture, and store the modified reconstructed picture in the memory 360, specifically, in a DPB of the memory 360. The various filtering methods may include, for example, deblocking filtering, a sample adaptive offset, an adaptive loop filter, a bilateral filter, and the like.

The (modified) reconstructed picture stored in the DPB of the memory 360 may be used as a reference picture in the inter predictor 332. The memory 360 may store the motion information of the block from which the motion information in the current picture is derived (or decoded) and/or the motion information of the blocks in the picture having already been reconstructed. The stored motion information may be transferred to the inter predictor 332 so as to be utilized as the motion information of the spatial neighboring block or the motion information of the temporal neighboring block. The memory 360 may store reconstructed samples of reconstructed blocks in the current picture, and transfer the reconstructed samples to the intra predictor 331.

In this disclosure, the embodiments described in the filter 260, the inter predictor 221, and the intra predictor 222 of the encoding apparatus 200 may be applied equally or to correspond to the filter 350, the inter predictor 332, and the intra predictor 331.

As described above, in performing video coding, prediction is performed to improve compression efficiency. Through this, a predicted block including prediction samples for a current block as a block to be coded (i.e., a coding target block) may be generated. Here, the predicted block includes prediction samples in a spatial domain (or pixel domain). The predicted block is derived in the same manner in an encoding apparatus and a decoding apparatus, and the encoding apparatus may signal information (residual information) on residual between the original block and the predicted block, rather than an original sample value of an original block, to the decoding apparatus, thereby increasing image coding efficiency. The decoding apparatus may derive a residual block including residual samples based on the residual information, add the residual block and the predicted block to generate reconstructed blocks including reconstructed samples, and generate a reconstructed picture including the reconstructed blocks.

The residual information may be generated through a transform and quantization procedure. For example, the encoding apparatus may derive a residual block between the original block and the predicted block, perform a transform procedure on residual samples (residual sample array) included in the residual block to derive transform coefficients, perform a quantization procedure on the transform coefficients to derive quantized transform coefficients, and signal related residual information to the decoding apparatus (through a bit stream). Here, the residual information may include value information of the quantized transform coefficients, location information, a transform technique, a transform kernel, a quantization parameter, and the like. The decoding apparatus may perform dequantization/inverse transform procedure based on the residual information and derive residual samples (or residual blocks). The decoding apparatus may generate a reconstructed picture based on the predicted block and the residual block. Also, for reference for inter prediction of a picture afterward, the encoding apparatus may also dequantize/inverse-transform the quantized transform coefficients to derive a residual block and generate a reconstructed picture based thereon.

FIG. 4 is a diagram illustrating an example of a video/image encoding method based on inter prediction, and FIG. 5 is a diagram schematically illustrating an example of an inter predictor in an encoding apparatus. The inter predictor in the encoding apparatus of FIG. 5 may be the same as or correspond to the inter predictor 221 of the encoding apparatus 200 of FIG. 2 described above.

Referring to FIGS. 4 and 5, the encoding apparatus may perform inter prediction on a current block in operation S400. The encoding apparatus may derive an inter prediction mode of the current block and motion information on the current block, and may generate prediction samples of the current block. Here, the procedures for determining the inter prediction mode, deriving the motion information, and generating the prediction samples may be performed simultaneously, or one of the procedures may be performed before other procedures.

For example, the inter predictor 221 of the encoding apparatus may include a prediction mode determiner 221_1, a motion information deriver 221_2, and a prediction sample deriver 221_3. The prediction mode determiner 221_1 may determine a prediction mode for the current block, the motion information deriver 221_2 may derive motion information on the current block through t, and the prediction sample deriver 221_3 may derive prediction samples of the current block. For example, the inter predictor 221 of the encoding apparatus may search for a block similar to the current block within a predetermined area (search area) of reference pictures through motion estimation, and may derive a reference block having a difference from the current block equal to or less than a minimum or a predetermined criterion. In doing so, a reference picture index indicating a reference picture in which the reference block is located may be derived, and a motion vector may be derived based on a difference between the locations of the reference block and the current block. The encoding apparatus may determine a mode applied to the current block from among various prediction modes. The encoding apparatus may compare RD costs for various prediction modes and determine an optimal prediction mode for the current block.

For example, when a skip mode or a merge mode is applied to the current block, the encoding apparatus may configure a merge candidate list and may derive a reference block having a difference of a minimum or predetermined criterion or less from a current block among reference blocks indicated by merge candidates included in the merge candidate list. In this case, a merge candidate associated with the derived reference block may be selected, and merge index information indicating the selected merge candidate may be generated and signaled to the decoding apparatus. The motion information on the current block may be derived using motion information on the selected merge candidate.

In another example, when an (A)MVP mode is applied to the current block, the encoding apparatus may configure a (A)MVP candidate list, and may use a motion vector of an MVP candidate selected from among motion vector predictor (mvp) candidates included in the (A)MVP candidate list as an mvp of the current block. In this case, for example, a motion vector indicating the reference block derived by the above-described motion estimation may be used as the motion vector of the current block, and an mvp candidate having a motion vector having a smallest difference from the motion vector of the current block among the mvp candidates may be the selected mvp candidate. A motion vector difference (MVD), which is a difference obtained by subtracting an mvp from the motion vector of the current block, may be derived. In this case, MVD-related information may be signaled to the decoding apparatus. In addition, when the (A)MVP mode is applied, the value of the reference picture index may be configured as reference picture index information and separately signaled to the decoding apparatus.

The encoding apparatus may derive residual samples based on the prediction samples in operation S410. The encoding apparatus may derive residual samples by comparing original samples of the current block with the prediction samples.

The encoding apparatus may encode image information including prediction information and residual information in operation S420. The encoding apparatus may output the encoded image information in the form of a bitstream. The prediction information is prediction procedure-related information and may include prediction mode information (e.g., a skip flag, a merge flag, a mode index, etc.) and information on motion information. The information on motion information may include candidate selection information (e.g., a merge index) which is information for deriving a motion vector. In addition, the information on motion information may include information indicating whether L0 prediction, L1 prediction, or bi-prediction is applied. The residual information is information on residual samples. The residual information may include information on quantized transform coefficients for the residual samples.

The output bitstream may be stored in a (digital) storage medium and transmitted to the decoding apparatus, or may be transmitted to the decoding apparatus through a network.

In addition, as described above, the encoding apparatus may generate a reconstructed picture (including reconstructed samples and reconstructed blocks) based on the reference samples and the residual samples. This is because the encoding apparatus can derive the same prediction result as that derived by the decoding apparatus, and in doing so, it is possible to improve coding efficiency. Therefore, the encoding apparatus may store the reconstructed picture (or reconstructed samples, reconstructed block) in a memory and use the reconstructed picture as a reference picture for inter prediction. As described above, an in-loop filtering procedure may be further applied to the reconstructed picture.

FIG. 6 is a diagram illustrating example of a video/image decoding method based on inter prediction, and FIG. 7 is a diagram schematically illustrating an example of an inter predictor in a decoding apparatus. The inter predictor in the decoding apparatus of FIG. 7 may be the same as or correspond to the inter predictor 332 of the decoding apparatus 300 of FIG. 3 described above.

Referring to FIGS. 6 and 7, the decoding apparatus may perform an operation corresponding to an operation performed by the encoding apparatus. The decoding apparatus may perform prediction on a current block based on received prediction information and derive prediction samples.

Specifically, the decoding apparatus may determine a prediction mode for the current block based on the received prediction information in operation S600. The decoding apparatus may determine which inter prediction mode is to be applied to the current block based on prediction mode information included in the prediction information.

Inter prediction mode candidates may include a skip mode, a merge mode and/or an (A)MVP mode, or may include various inter prediction modes.

The decoding apparatus may derive motion information on the current block based on the determined inter prediction mode in operation S610. For example, when the skip mode or the merge mode is to be applied to the current block, the decoding apparatus may configure a merge candidate list and select one merge candidate from among merge candidates included in the merge candidate list. Here, the selection may be performed based on the above-described selection information (merge index). The motion information on the current block may be derived using motion information on the selected merge candidate. The motion information on the selected merge candidate may be used as the motion information on the current block.

In another example, when the (A)MVP mode is to be applied to the current block, the decoding apparatus may construct the (A)MVP candidate list and may use a motion vector of a motion vector predictor (mvp) candidate selected from among mvp candidates included in the (A)MVP candidate list as an mvp of the current block. Here, the selection may be performed based on the above-described selection information (mvp flag or mvp index). In this case, an MVD of the current block may be derived based on the MVD-related information, and the motion vector of the current block may be derived based on the mvp and MVD of the current block. In addition, a reference picture index of the current block may be derived based on the reference picture index information. A picture indicated by the reference picture index in the reference picture list for the current block may be derived as a reference picture to be referred to for inter prediction of the current block.

Meanwhile, the motion information on the current block may be derived without configuring a candidate list, and in this case, the motion information on the current block may be derived according to a procedure disclosed in the prediction mode. In this case, configuring a candidate list as described above may be omitted.

The decoding apparatus may generate prediction samples for the current block based on the motion information on the current block in operation S620. In this case, a reference picture may be derived based on the reference picture index of the current block, and prediction samples of the current block may be derived using samples of the reference block indicated by the motion vector of the current block on the reference picture. Here, in some cases, a prediction sample filtering procedure for all or some of the prediction samples of the current block may be further performed.

For example, the inter predictor 332 of the decoding apparatus may include a prediction mode determiner 332_1, a motion information deriver 332_2, and a prediction sample deriver 332_3. The prediction mode determiner 332_1 may determine a prediction mode for a current block based on received prediction mode information, the motion information deriver 332_2 may derive motion information (motion vector and/or reference picture index, etc.) on the current block based on information on the received motion information, and the prediction sample derivation unit 332_3 may derive prediction samples for the current block.

The decoding apparatus may generate residual samples for the current block based on the received residual information in operation S630. The decoding apparatus may generate reconstructed samples for the current block based on the prediction samples and the residual samples and generate a reconstructed picture based the reconstructed samples for the current block in operation S640. As described above, an in-loop filtering procedure may be further applied to the reconstructed picture thereafter.

As described above, the inter prediction procedure may include determining an inter prediction mode, deriving motion information according to the determined prediction mode, and performing prediction based on the derived motion information (generating prediction samples). The inter prediction procedure may be performed in the encoding apparatus and the decoding apparatus as described above.

Meanwhile, in deriving the motion information on the current block, a motion information candidate(s) may be derived based on a spatial neighboring block(s) and a temporal neighboring block(s), and a motion information candidate of the current block may be selected based on the derived motion information candidate(s). In this case, the selected motion information candidate may be used as motion information on the current block.

FIG. 8 is a diagram for explaining a merge mode in inter prediction.

When the merge mode is applied, motion information on the current prediction block is not directly transmitted, but the motion information on the current prediction block is derived using motion information on a neighboring prediction block. Accordingly, the motion information on the current prediction block may be indicated by transmitting flag information indicating that the merge mode is used and a merge index indicating which prediction block in the vicinity is used. The merge mode may be referred to as a regular merge mode. For example, the merge mode may be applied when a value of a regular_merge_flag syntax element is 1.

In order to perform the merge mode, the encoding apparatus needs to search for a merge candidate block used to derive motion information on the current prediction block. For example, up to five merge candidate blocks may be used, but the embodiment(s) of the present disclosure are not limited thereto. In addition, the maximum number of merge candidate blocks may be transmitted in a slice header or a tile group header, but the embodiment(s) of the present disclosure are not limited thereto. After finding the merge candidate blocks, the encoding apparatus may generate a merge candidate list, and may select a merge candidate block having the smallest cost among the merge candidate blocks as a final merge candidate block.

The present disclosure may provide various embodiments of merge candidate blocks constituting the merge candidate list.

For example, the merge candidate list may use five merge candidate blocks. For example, four spatial merge candidates and one temporal merge candidate may be used. In a specific example, blocks shown in FIG. 8 may be used as spatial merge candidates. Hereinafter, the spatial merge candidate or a spatial MVP candidate to be described later may be referred to as an SMVP, and the temporal merge candidate or a temporal MVP candidate to be described later may be referred to as a TMVP.

The merge candidate list for the current block may be configured, for example, based on the following procedure.

A coding apparatus (encoding apparatus/decoding apparatus) may insert spatial merge candidates derived by searching spatial neighboring blocks of the current block into the merge candidate list. For example, the spatial neighboring blocks may include a bottom-left corner neighboring block, a left neighboring block, a top-right corner neighboring block, a top neighboring block, and a top-left corner neighboring block of the current block. However, this is merely an example, and in addition to the above-described spatial neighboring blocks, other neighboring blocks such as a right neighboring block, a bottom neighboring block, and a bottom-right neighboring block may be further used as the spatial neighboring blocks. The coding apparatus may detect available blocks by searching the spatial neighboring blocks based on the basis of priorities and may derive motion information on the detected blocks as the spatial merge candidates. For example, the encoding apparatus or the decoding apparatus may search the five blocks shown in FIG. 8 in order as in A1→B1→B0→A0→B2 and sequentially index available candidates to configure a merge candidate list.

The coding apparatus may search for temporal neighboring blocks of the current block and insert a derived temporal merge candidate into the merge candidate list. The temporal neighboring block may be positioned at a reference picture that is a different picture from the current picture in which the current block is positioned. The reference picture in which the temporal neighboring blocks are positioned may be called a collocated picture or a col picture. The temporal neighboring blocks may be searched for in the order of the bottom-right corner neighboring block and the bottom-right center block of the co-located block with respect to the current block on the col picture. Meanwhile, when motion data compression is applied, specific motion information may be stored as representative motion information on each predetermined storage unit in the col picture. In this case, there is no need to store motion information on all blocks in the predetermined storage unit, and through this, a motion data compression effect may be obtained. In this case, the predetermined storage unit may be predetermined as, for example, units of 16×16 samples or units of 8×8 samples, or size information on the predetermined storage unit may be signaled from the encoding apparatus to the decoding apparatus. When the motion data compression is applied, the motion information on the temporally neighboring blocks may be replaced with representative motion information on the predetermined storage unit in which the temporally neighboring blocks are positioned. That is, in this case, from an implementation point of view, instead of the predicted block positioned at the coordinates of the temporally neighboring blocks, the temporal merge candidate may be derived based on the motion information on the prediction block covering the arithmetic left shifted position after arithmetic right shift by a certain value based on the coordinates (top-left sample position) of the temporal neighboring block. For example, when the predetermined storage unit is units of 2n×2n samples, if the coordinates of the temporally neighboring blocks are (xTnb, yTnb), the motion information on the prediction block positioned at the corrected position ((xTnb>>n)<<n), (yTnb>>n)<<n)) may be used for the temporal merge candidate. Specifically, when the predetermined storage unit is units of 16×16 samples, if the coordinates of the temporally neighboring blocks are (xTnb, yTnb), the motion information on the prediction block positioned at the corrected position ((xTnb>>4)<<4), (yTnb>>4)<<4)) may be used for the temporal merge candidate. Alternatively, when the predetermined storage unit is units of 8×8 samples, if the coordinates of the temporally neighboring blocks are (xTnb, yTnb), the motion information on the prediction block positioned at the corrected position ((xTnb>>3)<<3), (yTnb>>3)<<3)) may be used for the temporal merge candidate.

The coding apparatus may check whether the number of current merge candidates is smaller than the number of maximum merge candidates. The maximum number of merge candidates may be predefined or signaled from the encoding apparatus to the decoding apparatus. For example, the encoding apparatus may generate and encode information on the maximum number of merge candidates, and transmit the information to the decoder in the form of a bitstream. When the maximum number of merge candidates is filled, the subsequent candidate addition process may not proceed.

As a result of the check, when the number of the current merge candidates is smaller than the maximum number of merge candidates, the coding apparatus may insert an additional merge candidate into the merge candidate list. For example, the additional merge candidates may include at least one of a history based merge candidate(s), pair-wise average merge candidate(s), ATMVP, a combined bi-predictive merge candidate (when the slice/tile group type of the current slice/tile group is type B) and/or a zero vector merge candidate which will be described later.

As a result of the check, when the number of the current merge candidates is not smaller than the maximum number of merge candidates, the coding apparatus may terminate the construction of the merge candidate list. In this case, the encoding apparatus may select an optimal merge candidate from among the merge candidates constituting the merge candidate list based on rate-distortion (RD) cost, and signal selection information indicating the selected merge candidate (ex. merge index) to the decoding apparatus. The decoding apparatus may select the optimal merge candidate based on the merge candidate list and the selection information.

The motion information on the selected merge candidate may be used as the motion information on the current block, and prediction samples of the current block may be derived based on the motion information on the current block. The encoding apparatus may derive residual samples of the current block based on the prediction samples, and may signal residual information on the residual samples to the decoding apparatus. As described above, the decoding apparatus may generate reconstructed samples based on residual samples derived based on the residual information and the prediction samples, and may generate a reconstructed picture based thereon.

When the skip mode is applied, the motion information on the current block may be derived in the same way as when the merge mode is applied. However, when the skip mode is applied, the residual signal for the corresponding block is omitted, and thus the prediction samples may be directly used as the reconstructed samples. The skip mode may be applied, for example, when the value of the cu_skip_flag syntax element is 1.

Meanwhile, the pair-wise average merge candidate may be referred to as a pair-wise average candidate or a pair-wise candidate. The pair-wise average candidate(s) may be generated by averaging pairs of predefined candidates in an existing merge candidate list. In addition, predefined pairs may be defined as {(0, 1), (0, 2), (1, 2), (0, 3), (1, 3), (2, 3)}. Here, the numbers may indicate merge indices for the merge candidate list. An averaged motion vector may be calculated separately for each reference list. For example, when two motion vectors are available in one list, the two motion vectors may be averaged even if they point to different reference pictures. For example, when only one motion vector is available, one motion vector may be used directly. For example, when there are no motion vectors available, the list may remain invalid.

For example, when the merge candidate list is not full even after pair-wise average merge candidates are added, that is, when the number of current merge candidates in the merge candidate list is smaller than the number of maximum merge candidates, a zero vector (zero MVP) may be inserted last until the maximum merge candidate number appears. That is, a zero vector may be inserted until the number of current merge candidates in the merge candidate list becomes the maximum number of merge candidates.

Meanwhile, conventionally, only one motion vector could be used to represent the motion of a coding block. That is, a translational motion model could be used. However, although this method may represent an optimal motion in units of blocks, it is not actually an optimal motion of each sample, and coding efficiency may be increased if an optimal motion vector may be determined in units of samples. To this end, an affine motion model may be used. An affine motion prediction method for coding using an affine motion model may be as follows.

The affine motion prediction method may represent a motion vector in units of each sample of a block using two, three, or four motion vectors. For example, the affine motion model may represent four types of motion. The affine motion model, which represents three motions (translation, scale, and rotation) among the motions that the affine motion model may represent, may be called a similarity (or simplified) affine motion model. However, the affine motion model is not limited to the above-described motion model.

FIGS. 9A and 9B are diagrams illustrating an example of CPMV for affine motion prediction.

In affine motion prediction, it is possible to determine a motion vector of a sample position in a block using two or more control point motion vectors (CPMV). In this case, a set of motion vectors may be referred to as an affine motion vector field (MVF).

For example, FIG. 9A may show a case in which two CPMVs are used, which may be referred to as a 4-parameter affine model. In this case, a motion vector at a sample position (x, y) may be determined as in Equation 1, for example.

$\begin{matrix} \left\{ \begin{matrix} {{mv}_{x} = {{\frac{{mv}_{1x} - {mv}_{0x}}{W}x} + {\frac{{mv}_{1y} - {mv}_{0y}}{W}y} + {mv}_{0x}}} \\ {{mv}_{y} = {{\frac{{mv}_{1y} - {mv}_{0y}}{W}x} + {\frac{{mv}_{1x} - {mv}_{0x}}{W}y} + {mv}_{0y}}} \end{matrix} \right. & \left\lbrack {{Equation}\mspace{14mu} 1} \right\rbrack \end{matrix}$

For example, FIG. 9B may illustrate a case where three CPMVs are used, which may be referred to as a 6-parameter affine model. In this case, a motion vector at a sample position of (x, y) may be determined as in Equation 2, for example.

$\begin{matrix} \left\{ \begin{matrix} {{mv}_{x} = {{\frac{{mv}_{1x} - {mv}_{0x}}{W}x} + {\frac{{mv}_{2x} - {mv}_{0x}}{H}y} + {mv}_{0x}}} \\ {{mv}_{y} = {{\frac{{mv}_{1y} - {mv}_{0y}}{W}x} + {\frac{{mv}_{2y} - {mv}_{0y}}{H}y} + {mv}_{0y}}} \end{matrix} \right. & \left\lbrack {{Equation}\mspace{14mu} 2} \right\rbrack \end{matrix}$

In Equations 1 and 2, {v_(x), v_(y)} may represent a motion vector at the (x, y) position. In addition, {v0_(x), v0_(y)} may indicate the CPMV of a control point (CP) at the top-left corner position of the coding block, and {v1_(x), v1_(y)} may indicate the CPMV of the CP at the top-right corner position, {v2_(x), v2_(y)} may indicate the CPMV of the CP at the bottom-left corner position. In addition, W may indicate a width of the current block, and H may indicate a height of the current block.

FIG. 10 is a diagram exemplarily illustrating a case in which an affine MVF is determined on the unit basis of a subblock.

In an encoding/decoding process, the affine MVF may be determined in a sample unit or in a predefined sub-block unit. For example, when the affine MVF is determined in a sample unit, a motion vector may be obtained based on each sample value. Alternatively, for example, when the affine MVF is determined in a sub-block unit, a motion vector of a corresponding block may be obtained based on a sample value of the center sample (which is a sample on the bottom-right side of the center, that is, the bottom-right sample among four center samples) of the sub-blocks. That is, the motion vector of the current block in the affine motion estimation may be derived in a sample or sub-block unit.

In the case of FIG. 10, the affine MVF is determined in the unit of 4×4 sub-blocks, but the size of the sub-blocks may be variously modified.

That is, when the affine prediction is available, three motion models applicable to the current block may include a translational motion model, a 4-parameter affine motion model, and a 6-parameter affine motion model. Here, the translational motion model may represent a model in which the existing block unit motion vector is used, the 4-parameter affine motion model may represent a model in which two CPMVs are used, and the 6-parameter affine motion model may represent a model in which three CPMVs are used.

Meanwhile, the affine motion prediction may include an affine MVP (or affine inter) mode or an affine merge mode.

FIG. 11 is a diagram for explaining an affine merge mode in inter prediction.

For example, in the affine merge mode, the CPMV may be determined according to the affine motion model of the neighboring block coded by the affine motion prediction. For example, neighboring blocks coded as affine motion prediction in search order may be used for affine merge mode. That is, when at least one of neighboring blocks is coded in the affine motion prediction, the current block may be coded in the affine merge mode. Here, the fine merge mode may be called AF_MERGE.

When the affine merge mode is applied, the CPMVs of the current block may be derived using CPMVs of neighboring blocks. In this case, the CPMVs of the neighboring block may be used as the CPMVs of the current block as they are, and the CPMVs of the neighboring block may be modified based on the size of the neighboring block and the size of the current block and used as the CPMVs of the current block.

On the other hand, in the case of the affine merge mode in which the motion vector (MV) is derived in units of subblocks, it may be called a subblock merge mode, which may be indicated based on a subblock merge flag (or a merge_subblock_flag syntax element). Alternatively, when the value of the merge_subblock_flag syntax element is 1, it may be indicated that the subblock merge mode is applied. In this case, an affine merge candidate list to be described later may be called a subblock merge candidate list. In this case, the subblock merge candidate list may further include a candidate derived by SbTMVP, which will be described later. In this case, the candidate derived by the SbTMVP may be used as a candidate of index 0 of the subblock merge candidate list. In other words, the candidate derived from the SbTMVP may be positioned before an inherited affine candidate or a constructed affine candidate to be described later in the subblock merge candidate list.

When the affine merge mode is applied, the affine merge candidate list may be constructed to derive CPMVs for the current block. For example, the affine merge candidate list may include at least one of the following candidates. 1) An inherited affine merge candidate. 2) Constructed affine merge candidate. 3) Zero motion vector candidate (or zero vector). Here, the inherited affine merge candidate is a candidate derived based on the CPMVs of the neighboring block when the neighboring block is coded in affine mode, the constructed affine merge candidate is a candidate derived by constructing the CPMVs based on the MVs of neighboring blocks of the corresponding CP in units of each CPMV, and the zero motion vector candidate may indicate a candidate composed of CPMVs whose value is 0.

The affine merge candidate list may be constructed as follows, for example.

There may be up to two inherited affine candidates, and the inherited affine candidates may be derived from affine motion models of neighboring blocks. Neighboring blocks can contain one left neighboring block and an upper neighboring block. The candidate blocks may be positioned as illustrated in FIG. 4. A scan order for a left predictor may be A₁→A₀, and a scan order for the upper predictor may be B₁→B₀→B₂. Only one inherited candidate from each of the left and top may be selected. A pruning check may not be performed between two inherited candidates.

When the neighboring affine block is checked, the control point motion vectors of the checked block may be used to derive a CPMVP candidate in the affine merge list of the current block. Here, the neighboring affine block may indicate a block coded in the affine prediction mode among neighboring blocks of the current block. For example, referring to FIG. 7, when a bottom-left neighboring block A is coded in the affine prediction mode, motion vectors v2, v3, and v4 of a top-left (top-left) corner, a top-right corner, and a bottom-left corner of the neighboring block A may be acquired. When the neighboring block A is coded with a 4-parameter affine motion model, two CPMVs of the current block may be calculated according to v2 and v3. When the neighboring block A is coded with a 6-parameter affine motion model, two CPMVs of the current block may be calculated according to v2, v3, and v4.

FIG. 12 is a diagram for explaining positions of candidates in an affine merge mode.

A constructed affine candidate may refer to a candidate constructed by combining neighboring translational motion information on each control point. Motion information on control points may be derived from specified spatial neighborhoods and temporal neighborhoods. CPMVk (k=0, 1, 2, 3) may indicate a k-th control point.

Referring to FIG. 12, for CPMV0, blocks may be checked in the order of B2→B3→A2 and a motion vector of a first available block may be used. For CPMV1, blocks may be checked in the order of B1→B0, and for CPMV2, blocks may be checked in the order of A1→A0. A temporal motion vector predictor (TMVP) may be used as CPMV3, if available.

After motion vectors of four control points are obtained, the affine merge candidates may be generated based on the acquired motion information. The combination of the control point motion vectors may correspond to any one of {CPMV0, CPMV1, CPMV2}, {CPMV0, CPMV1, CPMV3}, {CPMV0, CPMV2, CPMV3}, {CPMV1, CPMV2, CPMV3}, {CPMV0, CPMV1}, and {CPMV0, CPMV2}.

A combination of three CPMVs may constitute a 6-parameter affine merge candidate, and a combination of two CPMVs may constitute a 4-parameter affine merge candidate. In order to avoid the motion scaling process, when the reference indices of the control points are different, the relevant combinations of the control point motion vectors may be discarded.

FIG. 13 is a diagram for describing SbTMVP in inter-prediction.

Meanwhile, the subblock-based temporal motion vector prediction (SbTMVP) method may also be used. For example, the SbTMVP may be called advanced temporal motion vector prediction (ATMVP). The SbTMVP may use a motion field in a collocated picture to improve motion vector prediction and merge mode for CUs in the current picture. Here, the collocated picture may be called a col picture.

For example, the SbTMVP may predict motion at a subblock (or sub-CU) level. In addition, the SbTMVP may apply a motion shift before fetching the temporal motion information from the col picture. Here, the motion shift may be acquired from a motion vector of one of spatially neighboring blocks of the current block.

The SbTMVP may predict the motion vector of a subblock (or sub-CU) in the current block (or CU) according to two steps.

In the first step, the spatially neighboring blocks may be tested according to the order of A₁, B₁, B₀ and A₀ in FIG. 4. A first spatial neighboring block having a motion vector using a col picture as its reference picture may be checked, and the motion vector may be selected as a motion shift to be applied. When such a motion is not checked from spatially neighboring blocks, the motion shift may be set to (0, 0).

In the second step, the motion shift checked in the first step may be applied to obtain subblock level motion information (motion vectors and reference indices) from a col picture. For example, a motion shift may be added to the coordinates of the current block. For example, the motion shift may be set to the motion of A1 of FIG. 8. In this case, for each sub-block, motion information on a corresponding block in the col picture may be used to derive motion information on a corresponding subblock. Temporal motion scaling may be applied to align reference pictures of temporal motion vectors with reference pictures of the current block.

The combined subblock-based merge list including both the SbTVMP candidates and the affine merge candidates may be used for signaling of the affine merge mode. Here, the affine merge mode may be referred to as a subblock-based merge mode. The SbTVMP mode may be available or unavailable according to a flag included in a sequence parameter set (SPS). When the SbTMVP mode is available, the SbTMVP predictor may be added as the first entry of the list of subblock-based merge candidates, and the affine merge candidates may follow. The maximum allowable size of the affine merge candidate list may be five.

The size of the sub-CU (or subblock) used in the SbTMVP may be fixed to 8×8, and as in the affine merge mode, the SbTMVP mode may be applied only to blocks having both a width and a height of 8 or more. The encoding logic of the additional SbTMVP merge candidate may be the same as that of other merge candidates. That is, for each CU in the P or B slice, an RD check using an additional rate-distortion (RD) cost may be performed to determine whether to use the SbTMVP candidate.

Meanwhile, the predicted block for the current block may be derived based on the motion information derived according to the prediction mode. The predicted block may include prediction samples (prediction sample array) of the current block. When the motion vector of the current block indicates a fractional sample unit, an interpolation procedure may be performed. Through this, the prediction samples of the current block may be derived based on the fractional sample unit reference samples in the reference picture. When the affine inter-prediction (affine prediction mode) is applied to the current block, the prediction samples may be generated based on a sample/subblock unit MV. When the bi-prediction is applied, the prediction samples may be used as the prediction samples of the current block derived through a weighted sum or weighted average (according to a phase) of the prediction samples derived based on the L0 prediction (i.e., prediction using the reference picture and MVL0 in the reference picture list L0) and the prediction samples derived based on the L1 prediction (i.e., prediction using the reference picture and MVL1 in the reference picture list L1). Here, the motion vector in the L0 direction may be referred to as an L0 motion vector or MVL0, and the motion vector in the L1 direction may be referred to as an L1 motion vector or MVL1. In the case where the bi-prediction is applied, when the reference picture used for the L0 prediction and the reference picture used for the L1 prediction are positioned in different temporal directions with respect to the current picture (that is, case corresponding to the bidirectional direction or bi-prediction), which may be called a true bi-prediction.

Also, as described above, reconstructed samples and reconstructed pictures may be generated based on the derived prediction samples, and then procedures such as in-loop filtering may be performed.

Meanwhile, when the bi-prediction is applied to the current block, the prediction samples may be derived based on a weighted average. For example, the bi-prediction using the weighted average may be called bi-prediction with CU-level weight (BCW), bi-prediction with weighted Average (BWA), or weighted averaging bi-prediction.

The bi-prediction signal (i.e., bi-prediction samples) may be derived through a simple average of the L0 prediction signal (L0 prediction samples) and the L1 prediction signals. That is, the bi-prediction samples are derived as an average of the L0 prediction samples based on the L0 reference picture and MVL0 and the L1 prediction samples based on the L1 reference picture and MVL1. However, when the bi-prediction is applied, the bi-prediction signal (bi-prediction samples) may be derived through the weighted average of the L0 prediction signal and the L1 prediction signal as follows. For example, the bi-prediction signals (bi-prediction samples) may be derived as in Equation 3. P _(bi-pred)=((8−w)*P ₀ +w*P ₁+4)>>3  [Equation 3]

In Equation 3, Pbi-pred may indicate a value of a bi-prediction signal, that is, a prediction sample value derived by applying bi-prediction, and w may indicate a weight. In addition, P0 may indicate the value of the L0 prediction signal, that is, the prediction sample value derived by applying the L0 prediction, and P1 may indicate the value of the L1 prediction signal, i.e., the prediction sample value derived by applying the L1 prediction.

For example, 5 weights may be allowed in the weighted average bi-prediction. For example, the five weights w may include −2, 3, 4, 5, or 10. That is, the weight w may be determined as one of weight candidates including −2, 3, 4, 5, or 10. For each CU to which the bi-prediction is applied, the weight w may be determined by one of two methods. In the first method, the weight index may be signaled after a motion vector difference for an unmerged CU. In the second method, a weight index for a merged CU may be inferred from neighboring blocks based on a merge candidate index.

For example, the weighted average bi-prediction may be applied to a CU having 256 or more luma samples. That is, when the product of the width and height of the CU is greater than or equal to 256, the weighted average bi-prediction may be applied. In the case of a low-delay (low-delay) picture, five weights may be used, and in the case of a non-low-delay picture, three weights may be used. For example, the three weights may include 3, 4 or 5.

For example, in the encoding apparatus, a fast search algorithm may be applied to find a weight index without significantly increasing the complexity of the encoding apparatus. This algorithm may be summarized as follows. For example, when the current picture is a low-delay picture when combined with adaptive motion vector resolution (AMVR) (when AMVR is used as inter-prediction mode), unequal weights may be conditionally checked for 1-pel and 4-pel motion vector precision. For example, when combined with affine (when the affine prediction mode is used as the inter-prediction mode), in the case where the affine prediction mode is currently selected as the best mode, the affine motion estimation (ME) may be performed on unequal weights. For example, when two reference pictures of bi-prediction are the same, unequal weights may be conditionally checked. For example, when a specific condition is satisfied depending on a POC distance between the current picture and a reference picture, a coding quantization parameter (QP), and a temporal level, unequal weights may not be searched.

For example, the BCW weight index may be coded using one context coded bin followed by a bypass coded bin. The first context coded bin may indicate whether the same weight is used. When the unequal weights are used based on the first context coded bin, additional bins may be signaled using bypass coding to indicate unequal weights to be used.

Meanwhile, when the bi-prediction is applied, weight information used to generate prediction samples may be derived based on weight index information on a candidate selected from among candidates included in the merge candidate list.

According to an embodiment of the present disclosure, when constructing a motion vector candidate for a merge mode, weight index information on a temporal motion vector candidate may be derived as follows. For example, when a temporal motion vector candidate uses bi-prediction, weight index information on a weighted average may be derived. That is, when the inter-prediction type is bi-prediction, weight index information (or a temporal motion vector candidate) on a temporal merge candidate in the merge candidate list may be derived.

For example, weight index information for a weighted average of temporal motion vector candidates may always be derived as 0. Here, when the weight index information is 0, it may mean that the weights of respective reference directions (that is, the L0 prediction direction and the L1 prediction direction in bi-prediction) are identical to each other. For example, a procedure for deriving a motion vector of a luma component for the merge mode may be as shown in the following table.

TABLE 1 8.4.2.2 Derivation process for luma motion vectors for merge mode This process is only involved when merge_flag[ xCb ][ yPb ] is equal to 1, where ( xCb, yCb ) specify the top- left sample of the current luma coding block relative to the top-left luma sample of the current picture. Inputs to this process are: - a luma location ( xCb, yCb ) of the top-left sample of the current luma coding block relative to the top- left luma sample of the current picture, - a variable cbWidth specifying the width of the current coding block in luma samples, - a variable cbHeight specifying the height of the current coding block in luma samples. Outputs of this process are: - the luma motion vectors in 1/16 fractional-sample accuracy mvL0[ 0 ][ 0 ] and mvL1[ 0 ][ 0 ], - the reference indices refIdxL0 and refIdxL1, - the prediction list utilization flags predFlagL0[ 0 ][ 0 ] and predFlagL1[ 0 ][ 0 ], - the bi-prediction weight index gbiIdx. The bi-prediction weight index gbiIdx is set equal to 0. The motion vectors mvL0[ 0 ][ 0 ] and mvL1[ 0 ][ 0 ], the reference indices refIdxL0 and refIdxL1 and the prediction utilization flags predFlagL0[ 0 ][ 0 ] and predFlagL1[ 0 ][ 0 ] are derived by the following ordered steps: 1. The derivation process for merging candidates from neighbouring coding units as specified in clause 8.4.2.3 is involved with the luma coding block location ( xCb, yCb ), the luma coding block width cbWidth, and the luma coding block height cbHeight as inputs, and the output being the availability flags availableFlagA₀, availableFlagA₁, availableFlagB₀, availableFlagB₁ and availableFlagB₂, the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, refIdxLXB₁ and refIdxLXB₂, the prediction list utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁ and predFlagLXB₂, and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀, mvLXB₁ and mvLXB₂, with X being 0 or 1, and the bi-prediction weight indices gbiIdxA₀, gbiIdxA₁, gbiIdxB₀, gbiIdxB₁, gbiIdxB₂. 2. The reference indices, refIdxLXCol, with X being 0 or 1, and the bi-prediction weight index gbiIdxCol for the temporal merging candidate Col are set equal to 0. 3. The derivation process for temporal luma motion vector prediction as specified in in clause 8.4.2.11 is invoked with the luma location ( xCb, yCb ), the luma coding block width cbWidth, the luma coding block height cbHeight and the variable refIdxL0Col as inputs, and the output being the availability flag availableFlagL0Col and the temporal motion vector mvL0Col. The variables availableFlagCol, predFlagL0Col and predFlagL1Col are derived as follows: availableFlagCol = availableFlagL0Col (8-283) predFlagL0Col = availableFlagL0Col (8-284) predFlagL1C0l = 0 (8-285) gbiIdxCol = 0 (8-xxx) 4. When tile_group_type is equal to B, the derivation process for temporal luma motion vector prediction as specified in clause 8.4.2.11 is invoked with the luma location ( xCb, yCb ), the luma coding block width cbWidth, the luma coding block height cbHeight and the variable refIdxL1Col as inputs, and the output being the availability flag availableFlagL1Col and the temporal motion vector mvL1Col. The variables availableFlagCol and predFlagL1Col are derived as follows: availableFlagCol = availableFlagL0Col | | availableFlagL1Col (8-286) predFlagL1Col = availableFlagL1Col (8-287) 5. The merging candidate list, mergeCandList, is constructed as follows: i = 0 if( availableFlagA₁ ) mergeCandList[ i++ ] = A₁ if( availableFlagB₁ ) mergeCandList[ i++ ] = B₁ if( availableFlagB₀ ) mergeCandList[ i++ ] = B₀ (8-288) if( availableFlagA₀ ) mergeCandList[ i++ ] = A₀ if( availableFlagB₂ ) mergeCandList[ i++ ] = B₂ if( availableFlagCol ) mergeCandList[ i++ ] = Col 6. The variable numCurrMergeCand and numOrigMergeCand are set equal to the number of merging candidates in the mergeCandList. 7. When numCurrMergeCand is less than (MaxNumMergeCand − 1) and NumHmvpCand is greater than 0, the following applies: - The derivation process of history-based merging candidates as specified in 8.4.2.6 is invoked with mergeCandList, and numCurrMergeCand as inputs, and modified mergeCandList and numCurrMergeCand as outputs. - numOrigMergeCand is set equal to numCurrMergeCand. 8. The derivation process for pairwise average merging candidates specified in clause 8.4.2.4 is invoked with mergeCandList, the reference indices refIdxL0N and refIdxL1N, the prediction list utilization flags predFlagL0N and predFlagL1N, the motion vectors mvL0N and mvL1N of every candidate N in mergeCandList, numCurrMergeCand and numOrigMergeCand as inputs, and the output is assigned to mergeCandList, numCurrMergeCand, the reference indices refIdxL0avgCand_(k) and refIdxL1 avgCand_(k), the prediction list utilization flags predFlagL0avgCand_(k) and predFlagL1avgCand_(k) and the motion vectors mvL0avgCand_(k) and mvL1avgCand_(k) of every new candidate avgCand_(k) being added into mergeCandList. The bi-prediction weight index gbiIdx of every new candidate avgCand_(k) being added into mergeCandList is set equal to 0. The number of candidates being added, numAvgMergeCand, is set equal to ( numCurrMergeCand − numOrigMergeCand ). When numAvgMergeCand is greater than 0, k ranges from 0 to numAvgMergeCand − 1, inclusive. 9. The derivation process for zero motion vector merging candidates specified in clause 8.4.2.5 is invoked with the mergeCandList, the reference indices refIdxL0N and refIdxL1N, the prediction list utilization flags predFlagL0N and predFlagL1N, the motion vectors mvL0N and mvL1N of every candidate N in mergeCandList and numCurrMergeCand as inputs, and the output is assigned to mergeCandList, numCurrMergeCand, the reference indices refIdxL0zeroCand_(m) and refIdxL1zeroCand_(m), the prediction list utilization flags predFlagL0zeroCand_(m) and predFlagL1zeroCand_(m) and the motion vectors mvL0zeroCand_(m) and mvL1zeroCand_(m) of every new candidate zeroCand_(m) being added into mergeCandList. The bi-prediction weight index gbiIdx of every new candidate zeroCand_(m) being added into mergeCandList is set equal to 0. The number of candidates being added, numZeroMergeCand, is set equal to ( numCurrMergeCand − numOrigMergeCand − numAvgMergeCand ). When numZeroMergeCand is greater than 0, m ranges from 0 to numZeroMergeCand − 1, inclusive. 10. The variable mergeIdxOffset is set equal to 0. 11. When mmvd_flag[ xCb ][ yCb ] is equal to 1, the variable mmvdCnt is set equal to 0 and tThe following applies until mmvdCnt is greater than ( merge_idx[ xCb ][ yCb ] + mergeIdxOffset ) or mmvdCnt is equal to MaxNumMergeCand: - When candidate mergeCandList[ mmvdCnt ] uses the current decoded picture as its reference picture, mergeIdxOffset is incremented by 1. - The variable mmvdCnt is incremented by 1. 12. The following assignments are made with N being the candidate at position merge_idx[ xCb ][ yCb ] + mergeIdxOffset in the merging candidate list mergeCandList ( N = mergeCandList[ merge_idx[ xCb ][ yCb ] + mergeIdxOffset ] ) and X being replaced by 0 or 1: refIdxLX = redIdxLXN (8-289) predFlagLX[ 0 ][ 0 ] = predFlagLXN (8-290) mvLX[ 0 ][ 0 ][ 0 ] = mvLXN[ 0 ] (8-291) mvLX[ 0 ][ 0 ][ 1 ] = mvLXN[ 1 ] (8-292) gbiIdx = gbiIdxN (8-293) 13. When mmvd flag[ xCb ][ yCb ] is equal to 1, the following applies: - The derivation process for merge motion vector difference as specified in 8.4.2.7 is invoked with the luma location ( xCb, yCb ), the luma motion vectors mvL0[ 0 ][ 0 ], mvL1[ 0 ][ 0 ], the reference indices refIdxL0, refIdxL1 and the prediction list utilization flags predFlagL0[ 0][ 0 ] and predFlagL1[ 0 ][ 0 ] as inputs, and the motion vector differences mMvdL0 and mMvdL1 as outputs. - The motion vector difference mMvdLX is added to the merge motion vectors mvLX for X being 0 and 1 as follows: mvLX[ 0 ][ 0 ][ 0 ] += mMvdLX[ 0 ] (8-294) mvLX[ 0 ][ 0 ][ 1 ] += mMvdLX[ 1 ] (8-295)

Referring to Table 1, gbiIdx may indicate a bi-prediction weight index, and gbiIdxCol may indicate a bi-prediction weight index for a temporal merge candidate (eg, a temporal motion vector candidate in the merge candidate list). In the procedure for deriving the motion vector of the luma component for the merge mode (Table of Contents 3 of 8.4.2.2), the gbiIdxCol may be derived as 0. That is, the weight index of the temporal motion vector candidate may be derived as 0.

Alternatively, a weight index for a weighted average of temporal motion vector candidates may be derived based on weight index information on a collocated block. Here, the collocated block may be referred to as a col block, a co-located block, or a co-located reference block, and the col block may indicate a block at the same position as that of the current block in a reference picture. For example, a procedure for deriving a motion vector of a luma component for the merge mode may be as shown in the following table.

TABLE 2 8.4.2.2 Derivation process for luma motion vectors for merge mode This process is only invoked when merge_flag[ xCb ][ yPb ] is equal to 1, where ( xCb, yCb ) specify the top-left sample of the current luma coding block relative to the top-left luma samples of the current picture. Inputs to this process are: - a luma location ( xCb, yCb ) of the top-left sample of the current luma coding block relative to the top-left luma sample of the current picture, - a variable cbWidth specifying the width of the current coding block in luma samples, - a variable cbHeight specifying the height of the current coding block in luma samples. Outputs of this process are: - the luma motion vectors in 1/16 fractional-sample accuracy mvL0[ 0 ][ 0 ] and mvL1[ 0 ][ 0 ], - the reference indices refIdxL0 and refIdxL1, - the prediction list utilization flags predFlagL0[ 0 ][ 0 ] and predFlagL1[ 0 ][ 0 ], - the bi-prediction weight index gbiIdx. The bi-prediction weight gbiIdx is set equal to 0. The motion vectors mvL0[ 0 ][ 0 ] and mvL1[ 0 ][ 0 ], the reference indices refIdxL0 and refIdxL1 and the prediction utilization flags predFlagL0[ 0 ][ 0 ] and predFlagL1[ 0 ][ 0 ] are derived by the following ordered steps: 1. The derivation process for merging candidates from neighbouring coding units as specified in clause 8.4.2.3 is invoked with the luma coding block location ( xCb, yCb ), the luma coding block width cbWidth, and the luma coding block height cbHeight as inputs, and the output being the availability flags availableFlagA₀, availableFlagA₁, availableFlagB₀, availableFlagB₁ and availableFlagB₂, the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, refIdxLXB₁ and refIdxLXB₂, the prediction list utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀ predFlagLXB₁ and predFlagLXB₂, and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀, mvLXB₁ and mvLXB₂, with X being 0 or 1, and the bi-prediction weight indices gbiIdxA₀, gbiIdxA₁, gbiIdxB₀, gbiIdxB₁, gbiIdxB₂. 2. The reference indices, refIdxLXCol, with X being 0 or 1, and the prediction weight index gbiIdxCol for the temporal merging candidate Col are set equal to 0. 3. The derivation process for temporal luma motion vector prediction as specified in in clause 8.4.2.11 is invoked with the luma location ( xCb, yCb ), the luma coding block width cbWidth, the luma coding block height cbHeight and the variable refIdxL0Col as inputs, and the output being the availability flag availableFlagL0Col and the temporal motion vector mvL0Col. The variables availableFlagCol, predFlagL0Col and predFlagL1Col are derived as follows: availableFlagCol = availableFlagL0Col  (8-283) predFlagL0Col = availableFlagL0Col  (8-284) predFlagL1Col = 0  (8-285) gbiIdxCol = 0  (8-xxx) 4. When tile_group_type is equal to B, the derivation process for temporal luma motion vector prediction as specified in clause 8.4.2.11 is invoked with the luma location ( xCb, yCb ), the luma coding block width cbWidth, the luma coding block height cbHeight and the variable refIdxL1Col as inputs, and the output being the availability flag availableFlagL1Col and the temporal motion vector mvL1Col. The variables availableFlagCol and predFlagL1Col are derived as follow. availableFlagCol = availableFlagL0Col | |  (8-286) availableFlagL1Col predFlagL1Col = availableFlagL1Col  (8-287) gbiIdxCol = gbiIdxCol  (x-xxx) 5. The merging candidate list, mergeCandList, is constructed as follows: i = 0 if( availableFlagA₁ ) mergeCandList[ i++ ] = A₁ if( availableFlagB₁ ) mergeCandList[ i++ ] = B₁ if( availableFlagB₀ ) mergeCandList[ i++ ] = B₀  (8-288) if( availableFlagA₀ ) mergeCandList[ i++ ] = A₀ if( availableFlagB₂ ) mergeCandList[ i++ ] = B₂ if( availableFlagCol ) mergeCandList[ i++ ] = Col 6. The variable numCurrMergeCand and numOrigMergeCand are set equal to the number of merging candidates in the mergeCandList. 7. When numCurrMergeCand is less than (MaxNumMergeCand − 1) and NumHmvpCand is greater than 0, the following applies: - The derivation process of history-based merging candidates as specified in 8.4.2.6 is invoked with mergeCandList, and numCurrMergeCand as inputs, and modified mergeCandList and numCurrMergeCand as outputs. - numOrigMergeCand is set equal to numMergeCand. 8. The derivation process for pairwise average merging candidates specified in clause 8.4.2.4 is invoked with mergeCandList, the reference indices refIdxL0N and refIdxL1N, the prediction list utilization flags predFlagL0N and predFlagL1N, the motion vectors mvL0N and mvL1N of every candidate N in mergeCandList, numCurrMergeCand and numOrigMergeCand as inputs, and the output is assigned to mergeCandList, numCurrMergeCand, the reference indices refIdxL0avgCand_(k) and refIdxL1avgCand_(k), the prediction list utilization flags predFlagL0avgCand_(k) and predFlagL1avgCand_(k) and the motion vectors mvL0avgCand_(k) and mvL1avgCand_(k) of every new candidate avgCand_(k) being added into mergeCandList. The bi-prediction weight index gbiIdx of every new candidate avgCand_(k) being added into mergeCandList is set equal to 0. The number of candidates being added, numAvgMergeCand, is set equal to ( numCurrMergeCand − numOrigMergeCand ). When numAvgMergeCand is greater than 0, k ranges from 0 to numAvgMergeCand − 1, inclusive. 9. The derivation process for zero motion vector merging candidates specified in clause 8.4.2.5 is invoked with the mergeCandList, the reference indices refIdxL0N and refIdxL1N, the prediction list utilization flags predFlagL0N and predFlagL1N, the motion vectors mvL0N and mvL1N of every candidate N in mergeCandList and numCurrMergeCand as inputs, and the outputs is assigned to mergeCandList, numCurrMergeCand, the reference indices refIdxL0zeroCand_(m) and refIdxL1zeroCand_(m) the prediction list utilization flags predFlagL0zeroCand_(m) and predFlagL1zeroCand_(m) and the motion vectors mvL0zeroCand_(m) and mvL1zeroCand_(m) of every new candidate zeroCand_(m) being added into mergeCandList. The bi-prediction weight index gbiIdx of every new candidate zeroCand_(m) being added into mergeCandList is set equal to 0. The number of candidates being added, numZeroMergeCand, is set equal to ( numCurrMergeCand − numOrigMergeCand − numAvgMergeCand ). When numZeroMergeCand is greater than 0, m ranges from 0 to numZeroMergeCand − 1, inclusive. 10. The variable mergeIdxOffset is set equal to 0. 11. When mmvd_flag[ xCb ][ yCb ] is equal to 1, the variable mmvdCnt is set equal to 0 and tThe following applies until mmvdCnt is greater than ( merge_idx[ xCb ][ yCb ] + mergeIdxOffset ) or mmvdCnt is equal to MaxNumMergeCand: - When candidate mergeCandList[ mmvdCnt ] uses the current decoded picture as its reference picture, mergeIdxOffset is incremented by 1. - The variable mmvdCnt is incremented by 1. 12. The following assignments are made with N being the candidate at position merge_idx[ xCb ][ yCb ] + mergeIdxOffset in the merging candidate list mergeCandList ( N = mergeCandList[ merge idx[ xCb ][ yCb ] + mergeIdxOffset ] ) and X being replaced by 0 or 1. refIdxLX = refIdxLXN  (8-289) predFlagLX[ 0 ][ 0 ] = predFlagLXN  (8-290) mvLX[ 0 ][ 0 ][ 0 ] = mvLXN[ 0 ]  (8-291) mvLX[ 0 ][ 0 ][ 1 ] = mvLXN[ 1 ]  (8-292) gbiIdx = gbiIdxN  (8-293) 13. When mmvd_flag[ xCb ][ yCb ] is equal to 1, the following applies: - The derivation process for merge motion vector difference as specified in 8.4.2.7 is invoked with the luma location ( xCb, yCb ), the luma motion vectors mvL0[ 0 ][ 0 ], mvL1[ 0 ][ 0 ], the reference indices refIdxL0, refIdxL1 and the prediction list utilization flags predFlagL0[ 0 ][ 0 ] and predFlagL1[ 0 ][ 0 ] as inputs, and the motion vector differences mMvdL0 and mMvdL1 as outputs. - The motion vector difference mMvdLX is added to the merge motion vectors mvLX for X being 0 and 1 as follows: mvLX[ 0 ][ 0 ][ 0 ] += mMvdLX[ 0 ]  (8-294) mvLX[ 0 ][ 0 ][ 1 ] += mMvdLX[ 1 ] (8-295)

Referring to Table 2, gbiIdx may indicate a bi-prediction weight index, and gbiIdxCol may indicate a bi-prediction weight index for a temporal merge candidate (eg, a temporal motion vector candidate in the merge candidate list). In the procedure of deriving the motion vector of the luma component for the merge mode, when the slice type or the tile group type is B (Table of Contents 4 of 8.4.2.2), the gbiIdxCol may be derived as gbiIdxCol. That is, the weight index of the temporal motion vector candidate may be derived as the weight index of the col block.

Meanwhile, according to another embodiment of the present disclosure, when constructing a motion vector candidate for a merge mode in units of subblocks, a weight index for a weighted average of temporal motion vector candidates may be derived. Here, the merge mode in units of subblocks may be referred to as an affine merge mode (in units of subblocks). The temporal motion vector candidate may indicate a subblock-based temporal motion vector candidate, and may be referred to as an SbTMVP (or ATMVP) candidate. That is, when the inter-prediction type is bi-prediction, the weight index information on the SbTMVP candidate (or a subblock-based temporal motion vector candidate) in the affine merge candidate list or the subblock merge candidate list may be derived.

For example, the weight index information on the weighted average of subblock-based temporal motion vector candidates may always be derived as 0. Here, the weight index information of 0 may mean that the weights of each reference direction (ie, the L0 prediction direction and the L1 prediction direction in bi-prediction) are the same. For example, a procedure for deriving a motion vector and a reference index in a subblock merge mode and a procedure for deriving a subblock-based temporal merge candidate may be as shown in Tables 3 and 4 be

TABLE 3 8.4.4.2 Derivation process for motion vectors and reference indices the merge mode Inputs to this process are: - a luma location (xCb, yCb) of the top-left sample of the current luma coding block relative to the top- left luma sample of the current picture, - two variables cbWidth and cbHeight specifying the width and the height of the luma coding block. Outputs of this process are: - the number of luma coding subblocks in horizontal direction numSbX and in vertical direction numSbY, - the reference indices refIdxL0 and refIdxL1, - the prediction list utilization flag arrays predFlagL0[ xSbIdx ][ ySbIdx ] and predFlagL1[ xSbIdx ][ ySbIdx ], - the luma subblock motion vector arrays in 1/16 fractional-sample accuracy mvL0[ xSbIdx ][ ySbIdx ] and mvL1[ xSbIdx ] [ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, - the chroma subblock motion vector arrays in 1/32 fractional-sample accuracy mvCL0[ xSbIdx ][ ySbIdx ] and mvCL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, - the bi-prediction weight index gbiIdx. The variables numSbX, numSbY and the subblock merging candidate list, subblockMergeCandList are derived by the following ordered steps: 1. When sps_sbtmvp_enabled flag is equal to 1, the following applies: - The derivation process for merging candidates from neighbouring coding units as specified in clause 8.4.2.3 is invoked with the luma coding block location ( xCb, yCb ), the luma coding block width cbWidth, the luma coding block height cbHeight and the luma coding block width as inputs, and the output being the availability flags availableFlagA₀, availableFlagA₁, availableFlagB₀, availableFlagB₁ and availableFlagB₂, the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, refIdxLXB₁ and refIdxLXB₂, the prediction list utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁ and predFlagLXB₂, and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀, mvLXB₁ and mvLXB₂, with X being 0 or 1. - The derivation process for subblock-based temporal merging candidates as specified in clause 8.4.4.2 is invoked with the luma location ( xCb, yCb ), the luma coding block width cbWidth, the luma coding block height cbHeight , the availability flags availableFlagA₀, availableFlagA₁, availableFlagB₀, availableFlagB₁, the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, refIdxLXB₁, the prediction list utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁ and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀, mvLXB₁ as inputs and the output being the availability flag availableFlagSbCol, the bi-prediction weight index gbiIdxSbCol, the number of luma coding subblocks in horizontal direction numSbX and in vertical direction numSbY, the reference indices refIdxLXSbCol, the luma motion vectors mvLXSbCol[ xSbIdx ][ ySbIdx ] and the prediction list utilization flags predFlagLXSbCol[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1 and X being 0 or 1. 2. When sps_affine_enabled_flag is equal to 1, the sample locations ( xNbA₀, yNbA₀ ), ( xNbA₁, yNbA₁ ), ( xNbA₂, yNbA₂ ), ( xNbB₀, yNbB₀ ), ( xNbB₁, yNbB₁ ), ( xNbB₂, yNbB₂ ), ( xNbB₃, yNbB₃ ), and the variables numSbX and numSbY are derived as follows: ( xA₀, yA₀ ) = ( xCb − 1, yCb + cbHeight ) (8-536) ( xA₁, yA₁ ) = ( xCb − 1, yCb + cbHeight − 1 ) (8-537) ( xA₂, yA₂ ) = ( xCb − 1, yCb ) (8-538) ( xB₀, yB₀ ) = ( xCb + cbWidth , yCb − 1 ) (8-539) ( xB₁, yB₁ ) = ( xCb + cbWidth − 1, yCb − 1 ) (8-540) ( xB₂, yB₂ ) = ( xCb − 1, yCb − 1 ) (8-541) ( xB₃, yB₃ ) = ( xCb, yCb − 1 ) (8-542) numSbX = cbWidth >> 2 (8-543) numSbY = cbHeight >> 2 (8-544) 3. When sps_affine_enabled_flag is equal to 1, the variableFlagA is set equal to FALSE and the following applies for ( xNbA_(k), yNbA_(k) ) from ( xNbA₀, yNbA₀ ) to ( xNbA₁, yNbA₁ ): - The availability derivation process for a block as specified in clause 6.4.X [Ed. (BB): Neighbouring blocks availability checking process tbd] is invoked with the current luma location ( xCurr, yCurr ) set equal to ( xCb, yCb ) and the neighbouring luma location ( xNbA_(k), yNbA_(k) ) as inputs, and the output is assigned to the block availability flag availableA_(k). - When availableA_(k) is equal to TRUE and MotionModelIdc[ xNbA_(k) ][ yNbA_(k) ] is greater than 0 and availableFlagA is equal to FALSE, the following applies: - The variable availableFlagA is set equal to TRUE, motionModelIdcA is set equal to MotionModelIdc[ xNbA_(k) ][ yNbA_(k) ], ( xNb, yNb ) is set equal to ( CbPosX[ xNbA_(k) ][ yNbA_(k) ], CbPosY[ xNbA_(k) ][ yNbA_(k) ] ), nbW is set equal to CbWidth[ xNbA_(k) ][ yNbA_(k) ], nbH is set equal to CbHeight[ xNbA_(k) ][ yNbA_(k) ], numCpMv is set equal to MotionModelIdc[ xNbA_(k) ][ yNbA_(k) ] + 1, and gbiIdxA is set equal to GbiIdx[ xNbA_(k) ][ yNbA_(k) ]. - For X being replaced by either 0 or 1, the following applies: - When PredFlagLX[ xNbAk ][ yNbAk ] is equal to 1, the  derivation process for luma affine control point motion vectors  from a neighbouring block as specified in clause 8.4.4.5 is invoked  with the luma coding block location ( xCb, yCb ), the luma coding  block width and height (cbWidth, cbHeight), the neighbouring luma  coding block location ( xNb, yNb ), the neighbouring luma coding block  width and height (nbW, nbH) and the number of control point motion  vectors numCpMv as input, the control point motion vector predictor  candidates cpMvLXA[ cpIdx ] with cpIdx = 0 .. numCpMv − 1 as  output. - The following assignments are made: predFlagLXA = (8-545) PredFlagLX[ xNbA_(k) ][ yNbA_(k) ] refIdxLXA = (8-546) RefIdxLX[ xNba_(k) ][ yNbA_(k) ] 4. When sps_affine_enabled_flag is equal to 1, the variableFlagB is set equal to FALSE and the following applies for ( xNbB_(k), yNbB_(k) ) from ( xNbB₀, yNbB₀ ) to ( xNnB₂, yNbB₂ ): - The availability derivation process for a block as specified in clause 6.4.X [Ed. (BB): Neighbouring blocks availability checking process tbd] is invoked with the current luma location. ( xCurr, yCurr ) set equal to ( xCb, yCb ) and the neighbouring luma location ( xNbB_(k), yNbB_(k) ) as inputs, and the output is assigned to the block availability flag availableB_(k). - When availableB_(k) is equal to TRUE and MotionModelIdc[ xNbB_(k) ][ yNbB_(k) ] is greater than 0 and availableFlagB is equal to FALSE, the following applies: - The variable availableFlagB is set equal to TRUE, motionModelIdcB is set equal to MotionModelIdc[ xNbB_(k) ][ yNbB_(k) ], ( xNb, yNb ) is set equal to (CbPosX[ xNbAB ][ yNbB_(k) ], CbPosY[ xNbB_(k) ][ yNbB_(k) ] ), nbW is set equal to CbWidth[ xNbB_(k) ][ yNbB_(k) ], nbH is set equal to CbHeight[ xNbB_(k) ][ yNbB_(k) ], numCpMv is set equal to MotionModelIdc[ xNbB_(k) ][ yNbB_(k) ] + 1, and gbiIdxB is set equal to GbiIdx[ xNbB_(k) ][ yNbB_(k) ]. - For X being replaced by either 0 or 1, the following applies: - When PredFlagLX[ xNbB_(k) ][ yNbB_(k) ] is equal to TRUE, the  derivation process for luma affine control point motion vectors  from a neighbouring block as specified in clause 8.4.4.5 is  invoked with the luma coding block location ( xCb, yCb ), the luma  coding block width and height (cbWidth, cbHeight), the neighbouring  luma coding block location ( xNb, yNb ), the neighbouring luma  coding block width and height (nbW, nbH), and the number of control  point motion vectors numCpMv as input, the control point motion  vector predictor candidates cpMvLXB[ cpIdx ] with cpIdx =  0 .. numCpMv − 1 as output. - The following assignments are made: predFlagLXB = (8-547) PredFlagLX[ xNbB_(k) ][ yNbB_(k) ] refIdxLXB = (8-548) RefIdxLX[ xNbB_(k) ][ yNbB_(k) ] 5. When sps_affine_enabled_flag is equal to 1, the derivation process for constructed affine control point motion vector merging candidates as specified in clause 8.4.4.6 is invoked with the luma coding block location ( xCb, yCb ), the luma coding block width and height (cbWidth, cbHeight), the availability flags availableA₀, availableA₁, availableB₀, availableB₁, availableB₂, avilableB₃ as inputs, and the availability flags availableFlagConstK, the reference indices refIdxLXConstK, prediction list utilization flags predFlagLXConstK, motion model indices motionModelIdcConstK and cpMvpLXConstK[ cpIdx ] with X being 0 or 1, K = 1..6, cpIdx = 0..2 as outputs and gbiIdxConstK is set equal with K = 1..6. 6. The initial subblock merging candidate list, subblockMergeCandList, is constructed as follows: i = 0 if( availableFlagSbCol ) subblockMergeCandList[ i++ ] = SbCol if( availableFlagA && i < MaxNumberSubblockMergeCand ) subblockMergeCandList[ i++ ] = A if( availableFlagB && i < maxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = B if( availableFlagConst1 && i < maxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const1 (8-549) if( availableFlagConst2 && i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const2 if( availableFlagConst3 && i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const3 if( availableFlagConst4 && i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const4 if( availableFlagConst5 && i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const5 if( availableFlagConst6 && i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const6 7. The variable numCurrMergeCand and numOrigMergeCand are set equal to the number of merging candidates in the subblockMergeCandList. 8. When numCurrMergeCand is less than MaxNumSubblockMergeCand, the following is repeated until numCurrMergeCand is equal to MaxNumSubblockMergeCand, with mvZero[0] and mvZero[1] both being equal to 0: - The reference indices, the prediction list utilization flags and the motion vectors of zeroCand_(m) with m equal to ( numCurrMergeCand − numOrigMergeCand ) are derived as follows: refIdxL0ZeroCand_(m) = 0 (8-550) predFlagL0ZeroCand_(m) = 1 (8-551) cpMvL0ZeroCand_(m)[ 0 ] = mvZero (8-552) cpMvL0ZeroCand_(m)[ 1 ] = mvZero (8-553) cpMvL0ZeroCand_(m)[ 2 ] = mvZero (8-554) refIdxL1ZeroCand_(m) = (8-555) ( tile_group_type = = B ) ? 0 : −1 predFlagL1ZeroCand_(m) = (8-556) ( tile_group_type = = B ) ? 1 : 0 cpMvL1ZeroCand_(m)[ 1 ] = mvZero (8-557) cpMvL1ZeroCand_(m)[ 1 ] = mvZero (8-558) cpMvL1ZeroCand_(m)[ 2 ] = mvZero (8-559) motionModelIdcZeroCand_(m) = 1 (8-560) gbiIdxZeroCand_(m) = 0 (8-561) - The candidate zeroCand_(m) with m equal to ( numCurrMergeCand − numOrigMergeCand ) is added at the end of subblockMergecandList and numMergeCand is incremented by 1 as follows: subblockMergeCandList[ numCurrCand++ ] = zeroCand_(m) (8-562) The variables refIdxL0, refIdxL1, predFlagL0[ xSbIdx ][ ySbIdx ], predFlagL1[ xSbIdx ][ ySbIdx ], mvL0[ xSbIdx ][ ySbIdx ], mvL1[ xSbIdx ][ ySbIdx ], mvCL0[ xSbIdx ][ ySbIdx ], and mvCL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1 are derived as follows: - If subblockMergeCandList[ merge_subblock_idx[ xCb ][ yCb ] ] is equal to SbCol, the bi-prediction weight index gbiIdx is set equal to 0 and the following applies with X being 0 or 1: refIdxLX = refIdxLXSbCol (8-563) - For xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, the following applies: predFlagLX[ xSbIdx ][ ySbIdx ] = (8-564) predFlagLXSbCol[ xSbIdx ][ ySbIdx ] mvLX[ xSbIdx ][ ySbIdx ][ 0 ] = (8-565) mvLXSbCol[ xSbIdx ][ ySbIdx ][ 0 ] mvLX[ xSbIdx ][ ySbIdx ][ 1 ] = (8-566) mvLXSbCol[ xSbIdx ][ ySbIdx ][ 1 ] - When predFlagLX[ xSbIdx ][ ySbIdx ], is equal to 1, the derivation process for chroma motion vectors in clause 8.4.2.13 is invoked with mvLX[ xSbIdx ][ ySbIdx ] and refIdxLX as inputs, and the output being mvCLX[ xSbIdx ][ ySbIdx ]. - The following assignment is made for x = xCb ..xCb + cbWidth − 1 and y = yCb..yCb + cbHeight − 1: MotionModelIdc[ x ][ y ] = 0 (8-567) - Otherwise (subblockMergeCandList[ merge_subblock_idx[ xCb ][ yCb ] ] is not equal to SbCol), the following applies with X being 0 or 1: - The following assignments are made with N being the candidate at position merge_subblock_idx[ xCb ][ yCb ] in the subblock merging candidate list subblockMergeCandList ( N = subblockMergeCandList[ merge subblock idx[ xCb ][ yCb ] ] ): refIdxLX = refIdxLXN (8-568) predFlagLX[ 0 ][ 0 ] = predFlagLXN (8-569) cpMvLX[ 0 ] = cpMvLXN[ 0 ] (8-570) cpMvLX[ 1 ] = cpMvLXN[ 1 ] (8-571) cpMvLX[ 2 ] = cpMvLXN[ 2 ] (8-572) numCpMv = motionModelIdxN + 1 (8-573) gbiIdx = gbiIdxN (8-574) - For xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, the following applies: predFlagLX[ xSbIdx ][ ySbIdx ] = predFlagLX[ 0 ][ 0 ] (8-575) - When predFlagLX[ 0 ][ 0 ] is equal to 1, the derivation process for motion vector arrays from affine control point motion vectors as specified in subclause 8.4.4.9 is invoked with the luma coding block location ( xCb, yCb ), the luma coding block width cbWidth, the luma prediction block height cbHeight, the number of control point motion vectors numCpMv, the control point motion vectors cpMvLX[ cpIdx ] with cpIdx being 0..2, and the number of luma coding subblocks in horizontal direction numSbX and in vertical direction numSbY as inputs, the luma subblock motion vector array mvLX[ xSbIdx ][ ySbIdx ] and the chroma subblock motion rector array mvCLX[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1 as outputs - The following assignment is made for x = xCb ..xCb + cbWidth − 1 and y = yCb..yCb + cbHeight − 1: MotionModelIdc[ x ][ y ] = numCpMv − 1 (8-576)

TABLE 4 8.4.4.3 Derivation process for subblock-based temporal merging candidates Inputs to this process are: - a luma location ( xCb, yCb ) of the top-left sample of the current luma coding block relative to the top-left luma sample of the current picture, - a variable cbWidth specifying the width of the current coding block in luma samples, - a variable cbHeight specifying the height of the current coding block in luma samples. - the availability flags availableFlagA₀, availableFlagA₁, availableFlagB₀, and availableFlagB₁, of the neighbouring coding units, - the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, refIdxLXB₁ of the neighbouring coding units, - the prediction list utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, and predFlagLXB₁ of the neighbouring coding units, - the motion vectors in 1/16 fractional-sample accuracy mvLXA₀, mvLXA₁, mvLXB₀, and mvLXB₁ of the neighbouring coding units. Outputs of this process are: - the availability flag availableFlagSbCol, - the number of luma coding subblocks in horizontal direction numSbX and in vertical direction numSbY, - the reference indices refIdxL0SbCol and refIdxL1SbCol, - the luma motion vectors in 1/16 fractional-sample accuracy mvL0SbCol[ xSbIdx ][ ySbIdx ] and mvL1SbCol[ xSbIdx ][ ySbIdx ] withxSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1, - the prediction list utilization flags predFlagL0SbCol[ xSbIdx ][ ySbIdx ] and predFlagL1SbCol[ xSbIdx ][ ySbIdx ] with xSbfIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1, - the bi-prediction weight index gbiIdxSbCol. The gbiIxSbCol is set equal to 0. ...

Referring to Tables 3 and 4 above, gbiIdx may indicate a bi-prediction weight index, gbiIdxSbCol may indicate a bi-prediction weight index for a subblock-based temporal merge candidate (eg, a temporal motion vector candidate in a subblock-based merge candidate list), and in the procedure (8.4.4.3) for deriving the subblock-based temporal merge candidate, the gbiIdxSbCol may be derived as 0. That is, the weight index of the subblock-based temporal motion vector candidate may be derived as 0.

Alternatively, weight index information on a weighted average of subblock-based temporal motion vector candidates may be derived based on weight index information on a temporal center block. For example, the temporal center block may indicate a subblock or sample positioned at the center of the col block or the col block, and specifically, may indicate a subblock positioned at the bottom-right of the four central subblocks or samples of the col block or a sample. For example, in this case, the procedure for deriving the motion vector and reference index in the subblock merge mode, the procedure for deriving the subblock-based temporal merge candidate, and the procedure for deriving the base motion information for the subblock-based temporal merge may be shown in Table 5, Table 6, and Table 7.

TABLE 5 8.4.4.2 Derivation process for motion vectors and reference indices in subblock merge mode Inputs to this process are: - a luma location ( xCb, yCb ) of the top-left sample of the current luma coding block relative to the top- left luma sample of the current picture, - two variables cbWidth and cbHeight specifying the width and the height of the luma coding block. Outputs of this process are: - the number of luma coding subblocks in horizontal direction numSbX and in vertical direction numSbY, - the reference indices refIdxL0 and refIdxL1, - the prediction list utilization flag arrays predFlagL0[ xSbIdx ][ ySbIdx ] and predFlagL1[ xSbIdx ][ ySbIdx ], - the luma subblock motion vector arrays in 1/16 fractional-sample accuracy mvL0[ xSbIdx ][ ySbIdx ] and mvL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, y SbIdx = 0..numSbY − 1, - the chroma subblock motion vector arrays in 1/32 fractional-sample accuracy mvCL0[ xSbIdx ][ ySbIdx ] and mvCL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, - the bi-prediction weight index gbiIdx. The variables numSbX, numSbY and the subblock merging candidate list, subblockMergeCandList are derived by the following: ordered steps: 1. When sps_sbtmvp_enabled_flag is equal to 1, the following applies: - The derivation process for merging candidates from neighbouring coding units as specified in clause 8.4.2.3 is invoked with the luma coding block location ( xCb, yCb ), the luma coding block width cbWidth, the luma coding block height cbHeight and the luma coding block width as inputs, and the output being the availability flags availableFlagA₀, availableFlagA₁, availableFlagB₀, availableFlagB₁ and availableFlagB₂, the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, refIdxLXB₁ and refIdxLXB₂, file prediction list utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁ and predFlagLXB₂, and the motion vectors mvLXA₀, mvLχA₁, mvLχB₁ and mvLXB₂, and mvLXB₂, with X being 0 or 1. - The derivation process for subblock-based temporal merging candidates as specified in clause 8.4.4.3 is invoked with the luma location ( xCb, yCb ), the luma coding block width cbWidth, the luma coding block height cbHeight , the availability flags availableFlagA₀ availableFlagA₁, availableFlagB₀, availableFlagB₁, the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, refIdxLXB₁, the prediction list utilization flags predFIagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁ and the motion vectors mvLXA₀, mvLXA₁, mvXB₀, mvLXB₁ as inputs and the output being the availability flag availableFlagSbCol, the bi-prediction weight index gbiIdxSbCol, the number of luma coding subblocks in horizontal direction numSbX and in vertical direction numSbY, the reference indices refIdxLXSbCol, the luma motion vectors mvLXSbCol[ xSbIdx ][ ySbIdx ] and the prediction list utilization flags predFlagLXSbCol[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1 and X being 0 or 1. 2. When sps_affine_enabled_flag is equal to 1, the sample locations ( xNbA₀, yNbA₀ ), ( xNbA₁, yNbA₁), ( xNbA₂, yNbA₂ ), ( xNbB₀, yNbB₀ ), ( xNbB₁, yNbB₁ ), ( xNbB₂, yNbB₂ ), ( xNbB₁, yNbB₃ ) and the variables numSbX and numSbY are derived as follow: ( xA₀, yA₀ ) = ( xCb − 1 yCb + cbHeight ) (8-536) ( xA₁, yA₁ ) = ( xCb − 1, yCb + cbHeight − 1 ) (8-537) ( xA₂, yA₂ ) = ( xCb − 1, yCb ) (8-538) ( xB₀, yB₀ ) = ( xCb + cbWidth, yCb − 1 ) (8-539) ( xB₁, yB₁ ) = ( xCb + cbWidth − 1, yCb − 1 ) (8-540) ( xB₂, yB₂ ) = ( xCb − 1, yCb − 1 ) (8-541) ( xB₃, yB₃ ) = ( xCb, yCb − 1 ) (8-542) numSbX = cbWidth >> 2 (8-543) numSbY = cbHeigh >> 2 (8-544) 3. When sps_affine_enabled_flag is equal to 1, the variable availableFlagA is set equal to FALSE and the following applies for ( xNbA_(k), yNbA_(k) ) from ( xNbA₀, yNbA₀ ) to ( xNbA₁, yNbA₁ ) - The availability derivation process for a block as specified in clause 6.4.X [Ed. (BB): Neighbouring blocks availability checking process tbd] is invoked with the current luma location ( xCurr, yCurr ) set equal to ( xCb, yCb ) and the neighbouring luma location ) xNb Ak, yNbA_(k) ) as inputs, and the output is assigned to the block availability flag availableA_(k). - When availableA_(k) is equal to TRUE and MotionModelIdc[ xNbA_(k) ][ yNbA_(k) ] is greater than 0 and availableFlagA is equal to FALSE, the following applies: - The variable availableFlagA is set equal to TRUE, motionModelIdcA is set equal to MotionModelIdc[ xNbA_(k) ][ yNbA_(k) ], ( xNb, yNb ) is set equal to ( CBPosX[ xNbA_(k) ][ yNbA_(k) ], CbPosY[ xNbA_(k) ][ yNbA_(k) ], nbW is set equal to CbWidth[ xNbA_(k) ][ yNbA_(k) ], nbH is set equal to CbHeight [ xNbA_(k) ][ yNbA_(k) ], numCpMv is set equal to MotionModelId [ xNbA_(k) ][ yNbA_(k) ] + 1, and gbiIdxA is set equal to GbiIdx[ xNbA_(k) ] [ yNbA_(k) ]. - For X being replaced by either 0 or 1, following applies: - When PredFlagLX[ xNbA_(k) ][ yNbA_(k) ] is equal to 1, the derivation process for luma affine  control point motion vectors from a neighbouring block as specified in clause 8.4.4.5 is  invoked with the luma coding block location ( xCb, yCb ), the luma coding block width  and height (cbWidth, cbHeight), the neighbouring luma coding block location  ( xNb, yNb ) the neighbouring luma coding block width and height (nbW, nbH) and the  number of control point motion vectors numCpMv as input, the control point motion  vector predictor candidates cpMvLXA[ cpIdx ] with cpIdx = 0 .. numCpMv − 1 as  output. - The following assignments are made:  predFlagLXA = PredFlagLX[ xNbA_(k) ][ xNbA_(k) ][ yNbA_(k) ] (8-545)  refIdxLXA = RefIdxLX[ xNbA_(k) ][ yNbA_(k) ] (8-546) 4. When sps_affine_enabled_flag is equal to 1, the variable availableFlagB is set equal to FALSE and the following applies for ( xNbB_(k), yNbB_(k) ) from ( xNbB₀, yNbB₀ ) to ( xNbB₂, yNbB₂ ): - The availability derivation process for a block as specified in clause 6.4.X [Ed. (BB): Neighbouring blocks availability checking process tbd] is invoked with the current luma location ( xCurr, yCurr ) set equal to ( xCb, yCb ) and the neighbouring luma location ( xNbB_(k), yNbB_(k) ) as inputs and the output is assigned to the block availability flag availableB_(k). - When availableB_(k) is equal to TRUE and MotionModelIdc[ xNbB_(k) ][ yNbB_(k) ] is greater than 0 and availableFlagB is equal to FALSE, the following applies: - The variable availableFlagB is set equal to TRUE, motionModelIdcB is set equal to MotionModelIdc[ xNbB_(k) ][ yNbB_(k) ], ( xNb, yNb ) is set equal to ( CbPosX[ xNbAB ][ yNbB_(k) ], CbPosY[ xNbB_(k) ][ yNbB_(k) ] ), nbW is set equal to CbWidth[ xNbB_(k) ][ yNbB_(k) ], nbH is set equal to CbHeight[ xNbB_(k) ][ yNbB_(k) ], numCpMv is set equal to MotionModelIdc[ xNbB_(k) ][ yNbB_(k) ] + 1, and gbiIdxB is set equal to GbiIdx[ xNbB_(k) ][ yNbB_(k) ]. - For X being replaced by either 0 or 1, the following applies: - When PredFlagLX[ xNbB_(k) ][ yNbB_(k) ] is equal to TRUE, the derivation process for luma  affine control point motion vectors from a neighbouring block as specified in clause  8.4.4.5 is invoked with the luma coding block location ( xCb, yCb ), the luma coding  block width and height (cbWidth, cbHeight), the neighbouring luma coding block location  ( xNb, yNb ), the neighbouring luma coding block width and height (nbW, nbH), and the  number of control point motion vectors numCpMv as input, the control point motion  vector predictor candidates cpMvLXB[ cpIdx ] with cpIdx = 0 .. numCpMv − 1 as output - The following assignments are made:  predFlagLXB = PredFlagLX[ xNbB_(k) ][ yNbB_(k) ] (8-547)  refIdxLXB = RefIdxLX[ xNbB_(k) ] [ yNbB_(k) ] (8-548) 5. When sps_affine_enabled_flag is equal to 1, the derivation process for constructed affine control point motion vector merging candidates as specified in clause 8.4.4.6 is invoked with the luma coding block location ( xCb, yCb ), the luma coding block width and height (cbWidth, cbHeight) the availability flags availableA₀, availableA₁, availableA₂, availableB₀, availableB₁, availableB₂, availableB₃ as inputs, and the availability flags availableFlagConstK, the reference indices refIdxLXConstK, prediction list utilization flags predFlagLXConstK, motion model indices motionModelIdcConstK and cpMvpLXConstK[ cpIdx ] with X being 0 or 1, K = 1..6, cpIdx = 0..2 as outputs and gbiIdxConstK s set equal to 0 with K = 1..6.. 6. The initial subblock merging candidate list, subblockMergeCandList, is constructed as follows: i = 0  if( availableFlagSbCol )  subblockMergeCandList[ i++ ] = SbCol  if( availableFlagA && i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = A  if( availableFlagB && i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = B  if( availabletoFlagConst1 && i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const1 (8-549)  if( availableFlagConst2 && i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const2  if( availableFlagConst3 && i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const3  if( availableFlagConst4 && i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const4  if( availableFlagConst5 && i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const5  if( availableFlagConst6 && 1 < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const6 7. The variable numCurrMergeCand and numOrigMergeCand are set equal to to the number of merging candidates in the subblockMergeCandList, 8. When numCurrMergeCand is less than MaxNumSubblockMergeCand, the following is repeated until numCurrMrgeCand is equal to maxNumSubblockMergeCand, with mvZero[0] and mvZero[1] both being equal to 0: - The reference indices, the prediction list utilization flags and the motion vectors of zeroCand_(m) with m equal to ( numCurrMergeCand − numOrigMergeCand ) are derived as follows:  refIdxL0ZeroCand_(m) = 0 (8-550)  predFlagL0ZeroCand_(m) − 1 (8-551)  cpMvL0ZeroCand_(m)[0] = mvZero (8-552)  cpMvL0ZeroCand_(m) [ 1 ] = mvZero (8-553)  cpMvL0ZeroCand_(m)[ 2 ] = mvZero (8-554)  refIdxL1ZeroCand_(m) = ( tile_group_type = = B ) ? 0 : −1 (8-555)  predFlagL1ZeroCand_(m) = ( tile_group_type = = B ) ? 1 : 0 (8-556)  cpMvL1ZeroCand_(m)[ 0 ] = mvZero (8-557)  cpMvL1ZeroCand_(m)[ 1 ] = mvZero (8-558)  cpMvL1ZeroCand_(m)[ 2 ] = mvZero (8-559)  motionModelIdcZeroCand_(m) = 1 (8-560)  gbiIdxZeroCand_(m) = 0 (8-561) -  The candidate zeroCand_(m) with m equal to ( numCurrMergeCand − numOrigMergeCand ) is added at  the end of subblockMergeCandList and numCurrMergeCand is incremented by 1 as follows:  subblockMergeCandList[ numCurrMergeCand++ ] = zeroCand_(m) (8-562) The variables refIdxL0, refIdxL1, predFlagL0[ xSbIdx ][ ySbIdx ], predFlagL1[ xSbIdx ][ ySbIdx ], mvL0[ xSbIdx ][ ySbIdx ], mvL1[ xSbIdx ][ ySbIdx ], mvCL0[ xSbIdx ][ ySbIdx ], and mvCL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1 are derived as follows: - If subblockMergeCandList merge subblock idx[ xCb ][ yCb ] ] is equal to SbCol, the bi-prediction weight index gbiIdx is set equal to 0 and the following applies with X being 0 or 1: refIdxLX = refIdxLXSbCol (8-563) - For xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, the following applies: predFlagLX[ xSbIdx ][ ySbIdx ] = predFlagLXSbCol[ xSbIdx ][ ySbIdx ] (8-564) mvLx[ xSbIdx ][ ySbIdx ][ 0 ] = mvLXSbCol[ xSbIdx ][ ySbIdx ][ 0 ] (8-565) mvLx[ xSbIdx ][ ySbIdx ][ 1 ] = mvLXSbCol[ xSbIdx ][ ySbIdx ][ 1 ] (8-566) - When predFlagLX[ xSbIdx ][ ySbIdx ], is equal to 1, the derivation process for chroma motion vectors in clause 8.4.2.13 is invoked with mvLX[ xSbIdx ][ ySbIdx ] and refIdxLX as inputs, and the output being mvCLX[ xSbIdx ][ ySbIdx ]. - The following: assignment is made for x = xCb ..xCb+ cbWidth − 1 and y = yCb..yCb + cbHeight − 1: MotionModeIdc[ x ][ y ] = 0 (8-567) - Otherwise (subblockMergeCandList[ merge subblock idx[ xCb ][ yCb ] ] is not equal to SbCol), the following applies with X being 0 or 1: - The following assignments are made with N being the candidate at position merge_subbbck_idx[ xCb ][ yCb ] in the subblock merging candidate list subblockMergeCandList ( N = subblockMergeCandList[ merge subblock idx[ xCb ][ yCb ] ] ):  refIdxLX = refIdxLXN (8-568)  predFlagLX[ 0 ][ 0 ] = predFLagLXN (8-569)  cpMvLX[ 0 ] = cpMvLXN[ 0 ] (8-570)  cpMvLX[ 1 ] = cpMvLXN[ 1 ] (8-571)  cpMvLX[ 2 ] = cpMvLXN[ 2 ] (8-572)  numCpMv = motionModelIdxN + 1 (8-573)  gbiIdx = gbiIdxN (8-574) - For xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, the following applies:  predFlagLX[ xSbIdx][ ySbIdx ] = predFlagLX[ 0 ][ 0 ] (8-575) - When predFlagLX[ 0 ][ 0 ] is equal to 1, the derivation, process for motion vector arrays from affine control point motion vectors as specified in subclause 8.4.4.9 is invoked with the luma coding block location ( xCb,yCb ), the luma coding block width cbWidth, the luma prediction block height cbHeight, the number of control point motion vectors numCpMv, the control point motion vectors cpMvLX[ cpIdx ] with cpIdx being 0..2, and the number of luma coding subblocks in horizontal direction numSbX and in vertical direction numSbY as inputs, the luma subblock motion vector array mvLX[ xSbIdx ][ ySbIdx ] and the chroma subblock motion vector array mvCLX[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1 as outputs. - The following assignment is made for x = xCb ..xCb + cbWidth − 1 and y = yCb..yCb + cbHeight − 1:  MotionModelIdc[ x ][ y ] = numCpMv − 1 (8-576)

TABLE 6 8.4.4.3 Derivation process for subblock-based temporal merging candidates Inputs to this process are: - a luma location ( xCb, yCb ) of the top-left sample of the current luma coding block relative to the top-left luma sample of the current picture, - a variable cbWidth specifying the width of the current coding block in luma samples, - a variable cbHeight specifying the height of the current coding block in luma samples. - the availability flags availableFlagA₀, availableFlagA₁, availableFlagB₀, and availableFlagB₁, of the neighbouring coding units. - the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, refIdxLXB₁ of the neighbouring coding units, - the prediction list utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, and predFlagLXB₁ of the neighbouring coding units, - the motion vectors in 1/16 fractional-sample accuracy mvLXA₀, mvLXA₁, mvLXB₀, and mvLXB₁ of the neighbouring coding units. Outputs of this process are: - the availability flag availableFlagSbCol, - the number of luma coding subblocks in horizontal direction numSbX and in vertical direction numSbY, - the reference indices refIdxL0SbCol and refIdxL1SbCol, - the luma motion vectors in 1/16 fractional-sample accuracy mvL0SbCol[ xSbIdx ][ ySbIdx ] and mvL1SbCol[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1, - the prediction list utilization flags predFlagL0SbCol[ xSbIdx ][ ySbIdx ] and predFlagL1SbCol[ xSbIdx ] [ ySbIdx ] withxSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1, - the bi-prediction weight index gbiIdxSbCol. The availability flag availableFlagSbCol is derived as follows. - If one or more of the following conditions is true, availableFlagSbCol is set equal to 0. - tile_group_temporal_mvp_enable_flag is equal to 0. - sps_sbtmvp_flag is equal to 0. - cbWidth is less than 8. - cbHeight is less than 8. - Otherwise, the following ordered steps apply: 1. The location ( xCtb, yCtb ) of the top-left sample of the luma coding tree block that contains the current coding block and the location ( xCtr, yCtr ) of the below-right center sample of the current luma coding block are derived as follows: xCtb = ( xCb >> CtuLog2Size ) << CtuLog2Size (8-577) yCtb = ( yCb >> CtuLog2Size ) << CtuLog2Size (8-578) xCtr = xCb + ( cbWidth / 2 ) (8-579) yCtr = yCb + ( cbHeight / 2 ) (8-580) 2. The luma location ( xColCtrCb, yColCtrCb ) is set equal to the top-left sample of the collocated luma coding block covering the location given by ( xCtr, yCtr ) inside ColPic relative to the top-left luma sample of the collocated picture specified by ColPic. 3. The derivation process for subblock-based temporal merging base motion data as specified in clause 8.4.4.4 is invoked with the location ( xCtb, yCtb ), the location ( xColCtrCb, yColCtrCb ), the availability flags availableFlagA₀, availableFlagA₁, availableFlagB₀ and availableFlagB₁, and the prediction list utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀ and predFlagLXB₁, and the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀ and refIdxLXB₁, and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀ and mvLXB₁, with X being 0 and 1 as inputs and the motion vectors ctrMvLX, the prediction list utilization flags ctrPredFlagLX and the reference indices ctrRefIdxLX of the collocated block, with X being 0 and 1, the bi-prediction weight index gbiIdxSbCol, and the temporal motion vector tempMV as outputs. 4. The variable availableFlagSbCol is derived as follows: -  If both ctrPredFlagL0 and ctrPredFlagL1 are equal to 0, availableFlagSbCol is set equal to 0. -  Otherwise, availableFlagSbCol is set equal to 1. When availableFlagSbCol is equal to 1, the following applies: - The variables numSbX, numSbY, sbWidth, sbHeight and refIdxLXSbCol are derived as follows:  numSbX = cbWidth >> 3 (8-581)  numSbY = cbHeight >> 3 (8-582)  sbWidth = cbWidth / numSbX (8-583)  sbHeight = cbHeight / numSbY (8-584)  refIdxLXSbCol = 0 (8-585) - For xSbIdx = 0..numSbX − 1 and ySbIdx = 0 .. numSbY − 1, the motion vectors mvLXSbCol[ xSbIdx ][ ySbIdx ] and prediction list utilization flags predFlagLXSbCol[ xSbIdx ][ ySbIdx ] are derived as follows: - The luma location ( xSb, ySb ) specifying the top-left sample of the current coding subblock relative to the top-left luma sample of the current picture is derived as follows: xSb = xCb + xSbIdx * sbWidth (8-586) ySb = yCb + ySbIdx + sbHeight (8-587) - The location ( xColSb, yColSb ) of the collocated sublock inside ColPic is derived as follows. xColSb = Clip3( xCtb,   Min( CurPicWidthInSamplesY − 1, xCtb + ( 1 << CtbLog2SizeY ) + 3 ). (8-588)   xSb + ( tempMv[1] >> 4 ) ) yColSb = Clip3( yCtb,   Min( CurPicHeightInsamplesY − 1, yCtb + ( 1 << CtbLog2SizeY ) − 1 ). (8-589)   ySb + ( tempMv[1] >> 4 ) ) - The variable currCb specifies the luma coding block covering the current coding subblock inside the current picture. - The variable colCb specifies the luma coding block covering the modified location given by ( ( xColSb >> 3 ) << 3, (yColSb >> 3 ) << 3 ) inside the ColPic. - The luma location ( xColCb, yColCb ) is set equal to the top-left sample of the collocated luma coding  block specified by colCb relative to the top-left luma sample of the collocated picture specified by  ColPic. - The derivation process for collocated motion vectors as specified in clause 8.4.2.12 is invoked with  currCb, colCb, ( xColCb, yColCb ), refIdxL0 set equal to 0 and sbFlag set equal to 1 as inputs and the  output being assigned to the motion vector of the subblock mvL0SbCol[ xSbIdx ][ ySbIdx ] and  available FlagL0SbCol. - The derivation process for collocated motion vectors as specified in clause 8.4.2.12 is invoked with  currCb, colCb, ( xColCb, yColCb ), refIdxL1 set equal to 0 and sbFlag set equal to 1 as inputs and the  output being assigned to the motion vector of the subblock mvL1SbCol[ xSbIdx ][ ySbIdx ] and  availableFlagL1SbCol. - When availableFlagL0SbCol and availableFlagL1SbCol are both equal to 0, the following applies for X  being 0 and 1:  mvLxSbCol[ xSbIdx ][ ySbIdx ] = ctrMvLX (8-590)  predFlagLxSbCol[ xSbIdx ][ ySbIdx ] = ctrPredFlagLX (8-591)

TABLE 7 8.4.4.4 Derivation process for subblock-based temporal merging base motion data Inputs to this process are: - the location ( xCtb, yCtb ) of the top-left sample of the luma coding tree block that contains the current coding block, - the location ( xColCtrCb, yColCtrCb ) of the top-left sample of the collocated luma coding block the covers the below-right center sample. - the availability flags availableFlagA₀, avilableFlagA₁, availableFlagB₀, and availableFlagB₁ of the neighbouring coding units, - the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, and refIdxLXB₁ of the neighbouring coding units. - the prediction list utilization flags predFlagLXA₀, predLXA₁, predFlagLXB₀, and predFlagLXB₁ of the neighbouring coding units, - the motion vectors in 1/16 fractional-sample accuracy mvLXA₀, mvLXA₁, mvLXB₀, and mvLXB₁ of the neighbouring-coding units. Outputs of this process are: - the motion vectors ctrMvL0 and ctrMvL1. - the prediction list utilization flags ctrPredFlagL0 and ctrPredFlagL1, - the reference indices ctrRefIdxL0 and ctrRefIdxL1, - the temporal motion vector tempMV, - the bi-prediction weight index gbiIdxSbCol. The variable tempMv is set as follows: tempMv[ 0 ] = 0 (8-592) tempMv[ 1 ] = 0 (8-593) The variable currPic specifies the current picture. The variable availableFlagN is set equal to FALSE, and the following applies: - When availableFlagA₁ is equal to 1, the following applies: - availableFlagN is set equal to TRUE, - refIdxLXN is set equal to refIdxLXA₀ and mvLXN is set equal to mvLXA₀, for X being replaced by 0 and 1. - When availableFlagN is equal to FALSE and availableFlagLB₁ is equal to 1, the following applies: - availableFlagN is set equal to TRUE, - refIdxLXN is set equal to refIdxLXB₀ and mvLXN is set equal to mvLXB₀, for X being replaced by 0 and 1. - When availableFlagN is equal to FALSE and availableFlagB₀ is equal to 1, the following applies: - availableFlagN is set equal to TRUE. - refIdxLXN is set equal to refIdxLXB₁ and mvLXN is set equal to mvLXB₁, for X being replaced by 0 and 1. - When availableFlagN is equal to FALSE and availableFlagA₀is equal to 1, the following applies: - availableFlagN is set equal to TRUE. - refIdxLXN is set equal to refIdxLXA₁ and mvLXN is set equal to mvLXA₁, for X being replaced by 0 and 1. When availableFlagN is equal to TRUE, the following applies: - If all of the following conditions are true, tempMV is set equal to mvL1N. - predFlagL1N is equal to 1, - DiffPicOrderCnt(ColPic, RefPicList1[refIdxL1N]) is equal to 0, - DiffPicOrderCnt(aPic, currPic) is less than or equal to 0 for every picture aPic in every reference picture list of the current tile group, - tile_group_type is equal to B, - collocated_from_l0_flag is equal to 0. - Otherwise if all the following conditions are true, tempMV is set equal to mvL0N: - predFlagL0N is equal to 1, - DiffPicOrderCnt(ColPic, RefPicList0[refIdxL0N]) is equal to 0. The location ( xColCb, yColCb ) of the collocated block inside ColPic is derived as follows. xColCb = Clip3(xCtb, 4) Min( CurPicWidthInSamplesY − 1, xCtb + ( 1 << CtbLog2SizeY ) + 3 ), (8-59 xColCtrCb + ( tempMv[0] >>> 4 ) ) yColCb = Clip3( yCtb, Min( CurPicHeightInSamplesY − 1, yCtb + ( 1 << CtbLog2SizeY ) − 1 ), (8-5 95) yColCtrCb + ( tempMv[1] >> 4 ) ) The array colPredMode is set equal to the prediction mode array CuPredMode of the collocated picture specified by ColPic. The motion vectors ctrMvL0 and ctrMvL1, the prediction list utilization flags ctrPredFlagL0 and ctrPredFlagL1, and the reference indices ctrRefIdxL0 and ctrRefIdxL1 are derived as follows: - If colPredMode[xColCb][yColCb] is equal to MODE INTER, the following applies: - The variable currCb specifies the luma coding block covering ( xCtrCb ,yCtrCb ) inside the current picture. - The variable colCb specifies the luma coding block covering the modified location given by ( ( xColCb >> 3 ) << 3, ( yColCb >> 3 ) << 3 ) inside the colPic. - The luma location ( xColCb, yColCb ) is set equal to the top-left sample of the collocated luma coding block specified by colCb relative to the top-left luma sample of the collocated picture specified by ColPic. - The gbiIdxSbCol is set equal to gbiIdxcolCb. - The derivation process for temporal motion vector prediction in subclause 8.4.2.12 is invoked with currCb, colCb, (xColCb, yColCb), centerRefIdxL0, and sbFlag set equal to 1 as inputs and the output being assigned to ctrMvL0 and ctrPredFlagL0. - The derivation process for temporal motion vector prediction in subclause 8.4.2.12 is invoked with currCb, colCb, (xColCb, yColCb), centerRefIdxL1, and sbFlag set equal to 1 as inputs and the output being assigned to ctrMvL1 and ctrPredFlagL1. - Otherwise, the following applies:  ctrPredFlagL0 = 0 (8-596)  ctrPredFlagL1 = 0 (8-597)

Referring to Table 5, Table 6, and Table 7, gbiIdx may indicate a bi-prediction weight index, and gbiIdxSbCol may indicate a bi-prediction weight index for a subblock-based temporal merge candidate (eg, a temporal motion vector candidate in a subblock-based merge candidate list).<0} In the procedure (8.4.4.4) for deriving base motion information on subblock-based temporal merge, the gbiIdxSbCol may be derived as gbiIdxcolCb. That is, the weight index of the subblock-based temporal motion vector candidate may be derived as the weight index of the temporal center block. For example, the temporal center block may indicate a subblock or sample positioned at the center of the col block or the col block, and specifically, may indicate a subblock positioned at the bottom-right of the four central subblocks or samples of the col block or a sample.

Alternatively, the weight index information on the weighted average of the subblock-based temporal motion vector candidates may be derived based on the weight index information in units of each subblock, and may be derived based on the weight index information on the temporal center block when the subblock is not available. For example, the temporal center block may indicate a subblock or sample positioned at the center of the col block or the col block, and specifically, may indicate a subblock positioned at the bottom-right of the four central subblocks or samples of the col block or a sample. For example, in this case, the procedure for deriving the motion vector and reference index in the subblock merge mode, the procedure for deriving the subblock-based temporal merge candidate, and the procedure for deriving the base motion information for the subblock-based temporal merge may be shown in Table 8, Table 9, and Table 10.

TABLE 8 8.4.42 Derivation process for motion vectors and reference indices in subblock merge mode Inputs to this process are: - a luma location ( xCb, yCb ) of the top-left sample of the current luma coding block relative to the top-left luma sample of the current picture, - two variables cbWidth and cbHeight specifying the width and the height of the luma coding block. Outputs of this process are: - the number of luma coding subblocks in horizontal direction numSbX and in vertical direction numSbY, - the reference indices refIdxL0 and refIdxL1, - the prediction list utilization flag arrays predFlagL0[ xSbIdx ][ ySbIdx ] and predFlagL1[ xSbIdx ][ ySbIdx ][ ySbIdx ], - the luma subblock motion vector arrays in 1/16 fractional-sample accuracy mvL0[ xSbIdx ][ ySbIdx ] and mvL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, - the chroma subblock motion vector arrays in 1/32 fractional-sample accuracy mvCL0[ xSbIdx ][ ySbIdx ] and mvCL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, - the bi-prediction weight index gbiIdx. The variables numSbX, numSbY and the subblock merging candidate list, subblockMergeCandList are derived by the following ordered steps: 1. When sps_sbtmvp_enabled_flag is equal to 1, the following applies: - The derivation process for merging candidates from neighbouring coding units as specified in clause 8.4.2.3 is invoked with the luma coding block location ( xCb, yCb ), the luma coding block width cbWidth, the luma coding block height cbHeight and the luma coding block width as inputs, and the output being the availability flags availableFlagA₀, availableFlagA₁, availableFlagB₀, availableFlagB₁ and availableFlagB₂, the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, refIdxLXB₁ and refIdxLXB₂, the prediction list utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁ and predFlagLXB₂, and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀, mvLXB₁ and mvLXB₂, with X being 0 or 1. - The derivation process for subblock-based temporal merging candidates as specified in clause 8.4.4.3 is invoked with luma location ( xCb, yCb ), the luma coding block width cbWidth, the luma coding block height cbHeight, the availability flags availableFlagA₀, availableFlagA₁, availableFlagB₀, availableFlagB₁, the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, refIdxLXB₁, the prediction list utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁ and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀, mvLBX₁ as inputs and the output being the availability flag availableFlagSbCol, the number of luma coding subblocks in horizontal direction numSbX and in vertical direction numSbY, the reference indices refIdxLXSbCol, the bi-prediction weight index gbiIdxSbCol[ xSbIdx ][ ySbIdx ], the luma motion vectors mvLXSbCol[ xSbIdx ][ ySbIdx ] and the predicition list utilization flags predFlagLXSbCol[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1 and X being 0 or 1. 2. When sps_affine_enabled_flag is equal to 1, the sample locations ( xNbA₀, yNbA₀ ),  ( xNnA₁, yNbA₁ ), ( xNbA₂, yNbA₂ ), ( xNbB₀, yNbB₀ ), ( xNbB₁, yNbB₁ ), ( xNbB₂, yNbB₂ ),  ( xNbB₃, yNbB₃ ), and the variables numSbX and numSbY are derived as follows:  ( xA₀, yA₀ ) = ( xCb − 1, yCb + cbHeight ) (8-536)  ( xA₁, yA₁ ) = ( xCb − 1, yCb + cbHeight − 1 ) (8-537)  ( xA₂, yA₂ ) = ( xCb − 1, yCb ) (8-538)  ( xB₀, yB₀ ) = ( xCb + cbWidth, yCb − 1 ) (8-539)  ( xB₁, yB₁ ) = ( xCb + cbWidth − 1, yCb − 1 ) (8-540)  ( xB₂, yB₂ ) = ( xCb − 1, yCb − 1 ) (8-541)  ( xB₃, yB₃ ) = ( xCb, yCb − 1 ) (8-542)  numSbX = cbWidth >> 2 (8-543)  numSbY = cbHeight >> 2 (8-544) 3. When sps_affine_enabled_flag is equal to 1, the variableFlagA is set equal to FALSE and the following applies for ( xNbA_(k), yNbA_(k) ) from ( xNbA₀, yNbA₀ ) to ( xNbA₁, yNbA₁ ): - The availability derivation process for a block as specified in clause 6.4.X [Ed. (BB); Neighbouring blocks- availability checking process tbd] is invoked with the current luma location ( xCurr, yCurr ) set equal to ( xCb, yCb ) and the neighbouring luma location ( xNbA_(k), yNbA_(k) ) as inputs, and the output is assigned to the block availbilty flag availableA_(k). - When availableA_(k) is equal to TRUE and MotionModelIdc[ xNbA_(k) ][ yNbA_(k) ] is greater than 0 and availableFLagA is equal to FALSE, the following applies: - The variable availableFlagA is set equal to TRUE, motionModelIdcA is set equal to MotionModelIdc[ xNbA_(k) ][ yNbA_(k) ], ( xNb, yNb ) is set equal to ( CbPosX[ xNbA_(k) ][ yNbA_(k) ], CbPosY[ xNbA_(k) ][ yNbA_(k) ] ), nbW is set equal to CbWidth[ xNbA_(k) ][ yNbA_(k) ], nbH is set equal to CbHeight[ xNbA_(k) ][ yNbA_(k) ], numCpMv is set equal to MotionModel[Idc[ xNbA_(k) ][ yNbA_(k) ] + 1, and gbiIdxA is set equal to GbiIdx[ xNbA_(k) ][ yNbA_(k) ]. - For X being replaced by either 0 or 1, the following applies: - When PredFlagLX[ xNbA_(k) ][ yNbA_(k) ] is equal to 1, the derivation process for luma affine  control point motion vectors from a neighbouring block asspecified in clause 8.4.4.5 is  invoked with the luma coding block location ( xCb, yCb ), the luma coding block width  and height (cbWidth, cbHeight), the neighbouring luma coding block location  ( xNb, yNb ), the neighbouring luma coding block width and height (nbW, nbH), and the  number of control point motion vectors numCpMv as input, the control point motion  vector predictor candidates cpMvLXA[ cpIdx ] with cpIdx = 0..numCpMv − 1 as  output. -  The folowing assignments are made: predFlagLXA = PRedFlagLX[ xNbA_(k) ][ (8-545) yNbA_(k) ] refIdxLXA = redIdxLX[ xNbAk ][ (8-546) yNbak ] 4. When sps_affine_enabled_flag is equal to 1, the variableFlagB is set equal to False and the following applies for ( xNbB_(k), yNnN_(k) ) from ( xNbB₀, yNbB₀ ) to ( xNbB₂, yNbB₂ ): - The availability derivation process for a block as specified in clause 6.4.X [Ed. (BB): Neighbouring blocks availability checking process tbd] is invoked with the current luma location ( xCurr, yCurr ) set equal to ( xCb, yCb ) and the neighbouring luma location ( xNbB_(k), yNbB_(k) ) as inputs, and the output is assigned to the block availability flag availableB_(k). - When availableB_(k) is equal to TRUE and MotionModelIdc[ xNbB_(k) ][ yNbB_(k) ] is greater than 0 and availableFlagB is equal to FALSE, the following applies: - The variable availableFlagB is set equal to TRUE, motionModelIdcB is set equal to MotionModelIdc[ xNbB_(k) ][ yNbB_(k) ], ( xNb, yNb ) is set equal to ( CbPosX[ xNbAB ][ yNbB_(k) ], CbPosY[ xNbB_(k) ][ yNbB_(k) ]), nbW is set equal to CbWidth[ xNbB_(k) ][ yNbB_(k) ], nbH is set equal to CbHeight[ xNbB_(k) ][ yNbB_(k) ], numCpMv is get equal to MotionModelIdc[ xNbB_(k) ][ yNbB_(k) ] + 1, and gbiIdxB is set equal to GbiIdx[ xNbB_(k) ][ yNbB_(k) ]. - For X being replaced by either 0 or 1, the following applies: - When PredFlagLX[ xNbB_(k) ][ yNbB_(k) ] is equal to TRUE, the derivation process for luma affine control point motion vectors from a neighbouring block as specified in clause 8.4.4.5 is involved with the luma coding block location ( xCb, yCb ), the luma coding block width and height (cbWidth, cbHeight), the neighbouring luma coding block location ( xNb, yNb ), the neighbouring luma cosing block width and height (nbW, nbH), and the number of control point motion vectors numCpMv as input, the control point motion vector predictor candidates cpMvLXB[ cpIdx ] with cpIdx = 0 .. numCpMv − 1 as output. - The following assignments are made: predFlagLXB = PredFlagLX[ xNbB_(k) ][ (8-547) yNbB_(k) ] refIdxLXB = refIdxLX[ xNbB_(k) ][ (8-548) yNbB_(k) ] 5. When sps_affine_enabled_flag is equal to 1, the derivation process for constructed affine control point motion vector merging candidates as specified in clause 8.4.4.6 is invoked with the luma coding block location ( xCb, yCb ), the luma coding block width and height (cbWidth, cbHeight), the avilability flags availableA₀, availableA₁, availableA₂, availableB₀, availableB₁, availableB₂, availableB₃ as inputs, and the availability flags availableFlagConstK, the reference indices refIdxLXConstK prediction list utilization flags predFlagLXConstK, motion model indices motionModelIdcConstK and cpMvpLXConstK[ cpIdx ] with X being 0 or 1, K = 1..6, cpIdx = 0..2 as outputs and gbiIdxConstK is set equal to 0 with K = 1..6.. : 6. The initial subblock merging candidate list, subblockMergeCandList, is constructed as follows i = 0 if( availableFlagsbCol )  subblockMergeCandList[ i++ ] = SbCol if( availableFLagA && i < maxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = A if( availableFlagB && i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = B if( availableFlagConst1 && i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const1 (8-549) if( availableFlagConst2 && i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const2 if( availableFlagConst3 && i < MaxnumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const3 if( availableFlagConst4 && i < maxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const4 if( availableFlagConst5 && i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const5 if( availableFlagConst6 && i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const6 7. The variable numCurrMergeCand and numOrigMergeCand are set equal to the number of merging candidates in the subblockMergeCandList 8. When numCurrMergeCand is less than MaxNumSubblockMergeCand, the following is repeated until numCurrMrgeCand is equal to MaxNumSublockMergeCand, with mvZero[0] and mvZero[1] both being equal to 0: - The reference indices, the prediction list utilization flags and the motion vectors of zeroCand_(m) with m equal to ( numCurrMergeCand − numOrigMergeCand ) are derived as follows: refIdxL0ZeroCand_(m) = 0 (8-550) predFlagL0ZeroCand_(m) = 1 (8-551) cpMvL0Zerocand_(m)[ 0 ] = mvZero (8-552) cpMvL0Zerocand_(m)[ 1 ] = mvZero (8-553) cpMvL0Zerocand_(m)[ 2 ] = mvZero (8-554) refIdxL1ZeroCand_(m) = ( tile_group_type = = B ) ? 0 : −1 (8-555) predFlagL1ZeroCand_(m) = ( tile_group_type = = B ) ? 1 : 0 (8-556) cpMvL1ZeroCand_(m)[ 0 ] = mvZero (8-557) cpMvL1ZeroCand_(m)[ 1 ] = mvZero (8-558) cpMvL1ZeroCand_(m)[ 2 ] = mvZero (8-559) motionModelIdcZerocand_(m) = 1 (8-560) gbiIdxZeroCand_(m) = 0 (8-561) - The candidate zeroCand_(m) with m equal to ( numCurrMergeCand − numMergeCand ) is added at the end of subblockMergeCandList and numCurrMergeCand is incremented by 1 as follows: sublockMergeCandList[ numCurrMergeCand++ ] = zeroCand_(m) (8-562) The variables refIdxL0, refIdxL1, predFlagL0[ xSbIdx ], predFlagL1[ xSbIdx ][ ySbIdx ], mvL0[ xSbIdx ][ ySbIdx ], mvL1[ xSbIdx][ ySbIdx ], mvCL0[ xSbIdx ] [ ySbIdx ], and mvCL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1 are derived as follows: - If subblockMergeCandList[ merge_subblock_idx[ xCb ][ yCb ] ] is equal to SbCol, the bi-prediction weight index gbiIdx is set equal to 0 and the following applies with X being 0 or 1: refIdxLX = refIdxLXSbCol (8-563) - For xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, the following applies: predFlagLX[ xSbIdx ][ ySbIdx ] = predFlagLXSbCol[ xSbIdx ][ ySbIdx ] (8-564) mvLX[ xSbIdx ][ ySbIdx ][ 0 ] = mvLXSbCol[ xSbIsx ][ ySbIdx ][ 0 ] (8-565) mvLX[ xSbIdx ][ ySbIdx ][ 1 ] = mvLXSbCol[ xSbIdx ][ 1 ] (8-566) - When predFlagLX[ xSbIdx ][ ySbIdx ], is equal to 1, the derivation process for chroma motion vectors in clause 8.4.2.13 is invoked with mvLX[ xSIdx ][ ySbIdx ] and refIdxLX as inputs, and the output being mvCLX[ xSIdx ][ ySbIdx ]. - The following assignment is made for x = xCb + cbWidth − 1 and y = yCb..yCb + cbHeight − 1: MotionModelIdc[ x ][ y ] = 0 (8-567) - Otherwise (stubblockMergeCandList[ merge_subblock_idx[ xCb ][ yCb ] ] is not equal to SbCol), the following applies with X being 0 or 1: - The following assignments are made with N being the candidate at position merge_sublock_idx[ xCb ][ yCb ] in the subblock merging candidate list subblockMergeCandList ( N = subblockMergeCandList[ merge_subblock_idx[ xCb ][ yCb ] ] ): refIdxLX = refIdxLXN (8-568) predFlagLX[ 0 ][ 0 ] = predFlagLXN (8-569) cpMvLX[ 0 ] = cpMvLXN[ 0 ] (8-570) cpMvLX[ 1 ] = cpMvLXN[ 1 ] (8-571) cpMvLX[ 2 ] = cpMvLXN[ 2 ] (8-572) numCpMv = motionModelIdxN + 1 (8-573) gbiIdx = gbiIdxN (8-574) - For xSbIdx = 0..numSbX − 1, vSbIdx = 0..numSbY − 1. the following applies: predFlagLX[ xSbIdx ][ ySbIdx ] = predFlagLX[ 0 ][ 0 ] (8-575) - When predFLagLX[ 0 ][ 0 ] is equal to 1, the derivation process for motion vector assays from affine control point motion vectors as specified in subclause 8.4.4.9 is invoked with the luma coding block location ( xCb, yCb ), the luma coding block width cbWidth, the luma prediction block height cbHeight, the number of control point motion vectors numCpMv, the control point motion vectors cpMvLX[ cpIdx ] with cpIdx being: 0..2, and the number of luma coding subblocks in horizontal direction numSbX and in vertical direction numSbY as inputs, the luma subblock motion vector array mvLX[ xSbIdx ][ ySbIdx ] and the chroma subblock motion vector array mvCLX[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1 as outputs. - The following assignments is made for x = xCb ..xCb + cbWidth − 1 and y = yCb..yCb + cbHeight − 1: MotionModelIdc[ x ][ y ] = numCpMv − 1 (8-576)

TABLE 9 8.4.4.3 Derivation process for subblock-based temporal merging candidates Inputs to this process are: - a luma location ( xCb, yCb ) of the top-left sample of the current luma coding block relative to the top-left luma sample of the current picture. - a variable cbWidth specifying the width of the current coding block in luma samples; - a variable cbHeight specifying the height of the current coding block in luma samples. - the availability flags availableFlagA₀, availableFlagA₁, availablaeFlagB₀, and availableFlagB₁ of the neighbouring coding units, - the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, and refIdxLXB₁, of the neighbouring coding units, - the prediction list utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, and predFlagLXB₁ of the neighbouring coding units, - the motion vectors in 1/16 fractional-sample accuracy mvLXA₀, mvLXA₁, mvLXB₀, and mvLXB₁ of the neighbouring coding units. - Outputs of this process are: - the availability flag availableFlagSbCol. - the number of luma coding subblocks in horizontal direction numSbX and in vertical direction numSbY, - the reference indices refIdxL0SbCol and refIdxL1SbCol, - the luma motion vectors in 1/16 fractional-sample accuracy mvL0SbCol[ xSbIdx ][ ySbIdx ] and mvL1SbCol[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1, - the bi-prediction weight index gbiIdxSbCol[ xSbIdx ][ ySbIdx ], the prediction list utilization flags predFlagL0SbCol[ xSbIdx ][ ySbIdx ] and predFlagL1SbCol[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1. The availability flag availableFlagSbCol is derived as follows. - If one or more of the following conditions is true, availableFlagSbCol is set equal to 0. - tile group temporal mvp enable flag is equal to 0. - sps_sbtmvp_flag is equal to 0. - cbWidth is less than 8. - cbHeight is less than 8. - Otherwise, the following ordered steps apply: 1.  The location ( xCtb, yCtb ) of the top-left sample of the luma coding tree block that contains the  current coding block and the location ( xCtr, yCtr ) of the below-right center sample of the current  luma coding block are derived as follows:  xCtb = ( xCb >> CtuLog2Size ) << CtuLog2Size (8-577)  yCtb = ( yCb >> CtuLog2Size ) << CtuLog2Size (8-578)  xCtr = xCb + ( cbWidth / 2 ) (8-579)  yCtr = yCb + ( cbHeight / 2 ) (8-580) 2.  The luma location ( xColCtrCb, yColCtrCb ) is set equal to the top-left sample of the collocated luma  coding block covering the location given by ( xCtr, yCtr ) inside ColPic relative to the top-left luma  sample of the collocated picture specified by ColPic. 3.  The derivation process for subblock-based temporal merging base motion data as specified in  clause 8.4.4.4 is invoked with location ( xCtb, yCtb ), the location ( xColCtrCb, yColCtrCb ),  the availability flags availableFlagA₀, availableFlagA₁, availableFlagB₀ and availableFlagB₁, and  the prediction list utillization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀ and  predFlagLXB₁, and the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀ and refIdxLXB₁,  and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀ and mvLXB₁, with X being 0 and 1 as inputs  and the motion vectors ctrMvLX, the predicition list utilization flags ctrPredFlagLX and the reference  indices ctrRefIdxLX of the collocated block, with X being 0 and 1, the bi-prediction weight index  ctrgiIdx, and the temporal motion vector tempMV as outputs. 4.  The variable availableFlagSbCol is derived as follows: - If both ctrPredFlagL0 and ctrPredFlagL1 are equal to 0, availableFlagSbCol is set equal to 0. - Otherwise, availableFlagSbCol is set equal to 1. When availableFlagSbCol is equal to 1, the following applies: - The variables numSbX, numSbY, sbWidth, sbHeight and refIdxLXSbCol are derived as follows: numSbX = cbWidth >> 3 (8-581) numSbY = cbHeight >> 3 (8-582) sbWidth = cbWidth / numSbX (8-583) sbHeight = cbHeight / numSbY (8-584) refIdxLXSbCol = 0 (8-585) - For xSbIdx = 0..numSbX − 1 and ySbIdx = 0 .. numSbY − 1, the motion vectors mvLXSbCol[ xSbIdx ][ ySbIdx ] and prediction list utilization flags predFlagLXSbCol[ xSbIdx ][ ySbIdx ] are derived as follows: - The luma location ( xSb, ySb ) specifying the top-left sample of the current coding subblock relative  to the top-left luma sample of the current picture is derived as follows: xSb = xCb + xSbIdx * sbWidth (8-586) ySb = yCb + ySbIdx * sbHeight (8-587) - The location ( xColSb, yColSb ) of the collocated subblock inside ColPic is derived as follows. xColSb = Clip3( xCtb, Min( CurPicWidthInSamplesY − 1, xCtb + ( 1 << CtbLog2SizeY ) + 3 ), (8-58 8) xSb + ( tempMv[0] >> 4 ) ) yColSb = Clip3( yCtb, Min( CurPicHeightInSapmplesY − 1, yCtb + ( 1 << CtbLog2SizeY) − 1 ), (8-5 89) ySb + (tempMv[1] >> 4 ) ) - The variable currCb specifies the luma coding block covering the current coding subblock inside the  current picture. - The variable colCb specifies the luma coding block covering the modified location given by  ( ( xColSb >> 3 ) << 3, ( yColSb >> 3 ) << 3 ) inside the ColPic. - The luma location ( xColCb, yColCb ) is set equal to the top-left sample of the collocated luma  coding block specified by colCb relative to the top-left luma sample of the collocated picture  specified by ColPic. - The gbiIdxSbCol[ xSbIdx ][ ySbIdx ] is set equal to gbiIdxcolCb - The derivation process for collocated motion vectors as specified in clause 8.4.2.12 is invoked with  currCb, colCb, ( xColCb, yColCb ), refIdxL0 set equal to 0 and sbFlag set equal to 1 as inputs and the  output being assigned to the motion vector of the subblock mvL0SbCol[ xSbIdx ][ ySbIdx ] and  availableFlagL0SbCol. - The derivation process for collected motion vectors as specified in clause 8.4.2.12 is invoked with  currCb, colCb, ( xColCb, yColCb ), refIdxL1 set equal to 0 and sbFlag set equal to 1 as inputs and the  output being assigned to the motion vector of the subblock mvL1SbCol[ xSbIdx ][ ySbIdx ] and  availableFlagL1SbCol1. - When availableFlagL1SbCol are both equal to 0, the following applies for X  being 0 and 1: mvLXSbCol[ xSbIdx ][ ysbIdx ] = ctrMvLX (8-590) predFlagLXSbCol[ xSbIdx ][ ySbIdx ] = ctrPredFlagLX (8-591) gbiIdxSbCo[ xSbIdx ][ ySbIdx ] = ctrgbiIdx (x-xxx)

TABLE 10 8.4.44 Derivation process for subblock-based temporal merging base motion data Inputs to this process are: - the location ( xCtb, yCtb ) of the top-left sample of the luma coding tree block that contains current coding block, - the location ( xColCtrCb, yColCtrCb ) of the top-left sample of the collocated luma coding block that covers the below-right center sample. the availability flags availableFlagA₀, availableFlagA₁, availableFlagB₀, and availableFlagB₁ of the neighbouring coding units, - the refence indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, and refIdxLXB₁ of the neighbouring coding units, - the prediction list utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, and predFlagLXB₁ of the neighbouring coding units, - the motion vectors in 1/16 fractional-sample accuracy mvLXA₀, mvLXA₁, mvLXB₀, and mvLXB₁ of the neighbouring coding units. Outputs of this process are: - the motion vectors ctrMvL0 and ctrMvL1, - the prediction list utilization flags ctrPredFlagL0 and ctrPredFlagL1, - the reference indices ctrRefIdxL0 and ctrPredFlagL1, - the temporal motion vector tempMV, - the bi-prediction weight index ctrgbiIdx. The variable tempMv is set as follows: tempMv[ 0 ] = 0 (8-592) tempMv[ 1 ] = 0 (8-593) The variable currPic specifies the current picture. The variable availableFlagN is set equal to FLASE, and the following applies: - When availableFlagA₁ is equal to 1, the following applies: - availableFlagN is set equal to TRUE, - refIdxLXN is set equal to refIdxLXA₀ and mvLXN is set equal to mvLXA₀, for X being replaced by 0 and 1. - When availableFLagN is equal to FALSE and availableFlagLB1 is equal to 1, the following applies: - availableFlagN is set equal to TRUE, - refIdxLXN is set equal to refIdxLXB₀ and mvLXN is set equal to mvLXB₀, for X being replaced by 0 and 1. - When availableFlagN is equal to FALSE and availableFlagB₀ is equal to 1, the following applies: - availableFlagN is set equal to TRUE - refIdxLXN is set equal to refIdxLXB₁ and mvLXN is set equal to mvLXB₁, for X being replaced by 0 and 1. - When availableFlagN is equal to FALSE and availableFlagA₀is equal to 1, the following applies: - availableFlagN is set equal to TRUE. - refIdxLXN is set equal to refIdxLXA₁ and mvLXN is set equal to mvLXA₁, for X being replaced by 0 and 1. When availableFlagN is equal to TRUE, the following applies: - If all of the following conditions are true, tempMV is set equal to mvL1N: - predFlagL1N is equal to 1, - DiffPicOrderCnt(ColPic, RefPicList1[refIdxL1N]) is equal to 0, - DiffPicOrderCnt(aPic, currPic) is less than or equal to 0 for every picture aPic in every reference picture list of the current tile group, - tile_group_type is equal to B, - collocated_from_l0_flag is equal to 0. - Otherwise if all of the following conditions are true, tempMV is set equal to mvL0N: - predFlagL0N is equal to 1, - DiffPicOrderCnt(ColPic, RefPicList0[refIdxL0N]) is equal to 0. The location ( xColCb, yColCb ) of the collocated block inside ColPic is derived as follows. xColCb = Clip3( xCtb, Min( CurrPicWidthInsamplesY − 1, xCtb + ( 1 << CtbLog2SizeY ) + 3 ), (8-59 4) xColCtrCb + ( tempMv[0] >> 4 ) ) yColCb = Clip3(yCtb, Min( curPicHeightInSamplesY − 1, yCtb + ( 1 << CtbLog2SizeY ) − 1 ), (8-5 95) yColCtrCb + 9 tempMv[1] >> 4 ) ) The array colPredMode is set equal to the prediction mode array CuPred Mode of the collocated picture specified by ColPic. The motion vectors ctrMvL0 and ctrMvL1, the prediction list utilization flags ctrPredFlagL0 and ctrPredFlagL1, and the reference indices ctrRefIdxL0 and ctrRefIdxL1 are derived as follows: - If colPredMode[xColCb][yColCb] is equal to MODE_INTER, the following applies: - The variable currCb specifies the luma coding block covering ( xCtrCb ,yCtrCb ) inside the current picture. - The variable colCb specifies the luma coding block covering the modified location given by ( ( xColCb >> 3 ) << 3, ( yColCb >> 3 ) << 3 ) inside the ColPic. - The luma location ( xColCb, yColCb ) is set to the top-left sample of the collocated luma coding block specified by colCb relative to the top-left luma sample of the collocated picture specified by ColPic. - The gbiIdxSbCol is set equal to ctrgbiIdx - The derivation process for temporal motion vector prediction in subclause 8.4.2.12 is invoked with currCb, colCb, (xColCb, yColCb), centerRefIdxL0, and sbFlag set equal to I as inputs and the output being assigned to ctrMvL0 and ctrPredFlagL0. - The derivation process for temporal motion vector prediction in subclause 8.4.2.12 is invoked with currCb, colCb, (xColCb, yColCb), centerRefIdxL1, and sbFlag set equal to 1 as inputs and the output being assigned to ctrMvL1 and ctrPredFlagL1. - Otherwise, the following applies: ctrPredFlagL0 = 0 (8-596) ctrPredFlagL1 = 0 (8-597)

Referring to Table 8, Table 9, and Table 10, gbiIdx may indicate a bi-prediction weight index, and gbiIdxSbCol may indicate a bi-prediction weight index for a subblock-based temporal merge candidate (eg, a temporal motion vector candidate in a subblock-based merge candidate list). In the procedure (8.4.4.3) for deriving base motion information on subblock-based temporal merge, the gbiIdxSbCol may be derived as gbiIdxcolCb. Alternatively, in the procedure (8.4.4.3) of deriving base motion information on subblock-based temporal merge according to a condition (eg, when availableFlagL0SbCol and availableFlagL1SbCol are both 0), the gbiIdxSbCol may be derived as ctrgbiIdx, and in the procedure (8.4.4.4) for deriving base motion information on subblock-based temporal merge, the ctrgbiIdx may be derived as gbiIdxSbCol. That is, the weight index of the subblock-based temporal motion vector candidate may be derived as a weight index in units of each subblock, or when the subblock is not available, may be derived as the weight index of the temporal center block. For example, the temporal center block may indicate a subblock or sample positioned at the center of the col block or the col block, and specifically, may indicate a subblock positioned at the bottom-right of the four central subblocks or samples of the col block or a sample.

Meanwhile, according to another embodiment of the present disclosure, when constructing a motion vector candidate for a merge mode, weight index information on a pair-wise candidate may be derived. For example, a pair-wise candidate may be included in the merge candidate list, and weight index information on a weighted average of the pair-wise candidate may be derived. The pair-wise candidate may be derived based on other merge candidates in the merge candidate list, and when the pair-wise candidate uses bi-prediction, a weight index for a weighted average may be derived. That is, when the inter-prediction type is bi-prediction, weight index information on pair-wise candidates in the merge candidate list may be derived.

The pair-wise candidate may be derived based on other two merge candidates among the candidates included in the merge candidate list. For example, the weight index information on the pair-wise candidate may be derived based on the weight index information of any one of the two merge candidates. Alternatively, for example, the weight index information on the pair-wise candidate may be derived based on weight index information on a candidate using bi-prediction among the two merge candidates.

The pair-wise candidate may be derived based on the first and second candidates among the candidates included in the merge candidate list. For example, the weight index information on the pair-wise candidate may be derived based on the weight index information of the first candidate. Accordingly, the weight index information on the pair-wise candidates can be derived as shown in Table 11 below

TABLE 11 bcwIdx = bcwIdx0

In Table 11, bcwIdx may correspond to the weight index information on the pair-wise candidate, and bcwIdx0 may correspond to the weight index information of the first candidate among candidates included in the merge candidate list.

Alternatively, for example, when the weight index information of each of the first candidate and the second candidate is the same each other, the weight index information on the pair-wise candidate may be derived based on the weight index information of the first candidate. Meanwhile, when the weight index information of each of the first candidate and the second candidate are not identical to each other, the weight index information on the pair-wise candidate may be derived based on the default weight index information. The default weight index information may correspond to weight index information for assigning the same weight to each of the L0 prediction samples and the L1 prediction samples. Accordingly, the weight index information on the pair-wise candidates can be derived as shown in Table 12 below

TABLE 12 if (bcwIdx0 = = bcwIdx1)  bcwIdx = bcwIdx0 else  bcwIdx = Default value

In Table 12, bcwIdx may correspond to the weight index information on the pair-wise candidates, bcwIdx0 may correspond to weight index information of the first candidate among candidates included in the merge candidate list, and bcwIdx1 may correspond to weight index information of a second candidate among candidates included in the merge candidate list. The default value may correspond to default weight index information.

Alternatively, when the weight index information of each of the first candidate and the second candidate is the same each other, the weight index information on the pair-wise candidate may be derived based on the weight index information of the first candidate. Meanwhile, when the weight index information on each of the first candidate and the second candidate is not the same, the weight index information on the pair-wise candidate may be derived based on the weight index information other than the default weight index information among the weight index information on each of the first candidate and the second candidate. The default weight index information may correspond to weight index information for assigning the same weight to each of the L0 prediction samples and the L1 prediction samples.

Meanwhile, according to another embodiment of the present disclosure, when constructing a motion vector candidate for a merge mode in units of subblocks, weight index information on a weighted average of temporal motion vector candidates may be derived. Here, the merge mode in units of subblocks may be referred to as an affine merge mode (in units of subblocks). The temporal motion vector candidate may indicate a subblock-based temporal motion vector candidate, and may be referred to as an SbTMVP (or ATMVP) candidate. The weight index information on the SbTMVP candidate may be derived based on the weight index information on the left neighboring block of the current block. That is, when the candidate derived by SbTMVP uses bi-prediction, the weight index of the left neighboring block of the current block may be derived as the weight index for the subblock-based merge mode.

For example, since the SbTMVP candidate may derive a col block based on the spatially adjacent left block (or left neighboring block) of the current block, the weight index of the left neighboring block may be considered reliable. Accordingly, the weight index for the SbTMVP candidate may be derived as the weight index of the left neighboring block.

Meanwhile, according to another embodiment of the present disclosure, when constructing a motion vector candidate for an affine merge mode, in the case where an affine merge candidate uses bi-prediction, weight index information on a weighted average may be derived. That is, when the inter-prediction type is bi-prediction, weight index information on a candidate in the affine merge candidate list or the subblock merge candidate list may be derived.

For example, among affine merge candidates, a constructed affine merge candidate may derive CP0, CP1, CP2, or CP3 candidates based on a spatially adjacent block of the current block or a temporally adjacent block to indicate a candidate for deriving the MVF as the affine model.

FIG. 14 is a diagram illustrating control points for a constructed affine merge candidate.

Referring to FIG. 14, for example, CP0 may indicate a control point located at a top-left sample position of the current block, CP1 may indicate a control point located at a top-right sample position of the current block, and CP2 may indicate a control point located at a bottom-left sample position of the current block. In addition, CP3 may indicate a control point located at a bottom-right sample position of the current block.

For example, a constructed affine merge candidate among affine merge candidates may be generated by a combination of motion vectors for each control point of the current block. An affine merge candidate may include at least one of the CPMV0 for the control point CP0, the CPMV1 for the control point CP1, and the CPMV2 for the control point CP2. The CPMV0, the CPMV1, the CPMV2, and the CPMV3 may correspond to motion vectors for the CP0, the CP1, the CP2, and the CP3, respectively.

The CPMV0 may be derived based on a top-left neighboring block of the current block, a first left neighboring block adjacent to a bottom side of the top-left neighboring block, or a first top neighboring block adjacent to a right side of the top-left neighboring block. The CPMV1 may be derived based on a top-right neighboring block of the current block or a second top neighboring block adjacent to a left side of the top-right neighboring block. In addition, CPMV2 may be derived based on a bottom-left neighboring block of the current block or a second left neighboring block adjacent to a top side of the bottom-left neighboring block.

For example, the affine merge candidate may be generated based on a combination of control points of the current block, such as {CP0, CP1, CP2}, {CP0, CP1, CP3}, {CP0, CP2, CP3}, {CP1, CP2, CP3}, {CP0, CP1}, and {CP0, CP2}. For example, the affine merge candidate may include at least one of {CPMV0, CPMV1, CPMV2}, {CPMV0, CPMV1, CPMV3}, {CPMV0, CPMV2, CPMV3}, {CPMV1, CPMV2, CPMV3}, {CPMV0, CPMV1}, and {CPMV0, CPMV2}.

In one embodiment, weight index information for the affine merge candidate may be derived as shown in Table 13 below.

TABLE 13 if (bcwIdxCorner0 = = bcwIdxCorner1 && bcwIdxGroup0 = = bcwIdxGroup2)  bcwIdxConst = bcwIdxCorner0 else if (bcwIdxCorner0 = = bcwIdxCorner2 && bcwIdxGroup0 = = bcwIdxGroup1)  bcwIdxConst = bcwIdxCorner0 else if (bcwldxCorner1 = = bcwIdxCorner2 && bcwIdxGroup1 = = bcIdxGroup0)  bcwIdxConst = bcwIdxCorner2 else  bcwIdxConst = Default value

In Table 13, bcwIdxCornerX (X=0, 1, 2) may indicate weight index information for each control point of the current block. For example, bcwIdxCorner0 may correspond to weight index information for the CP0, bcwIdxCorner1 may correspond to weight index information for the CP1, and bcwIdxCorner2 may correspond to weight index information for the CP2. Alternatively, as described above, the affine merge candidate may be generated by a combination of control pints, such as {CP0, CP1, CP2}, {CP0, CP1, CP3}, {CP0, CP2, CP3}, {CP1, CP2, CP3}, {CP0, CP1}, and {CP0, CP2}, and in this case, bcwIdxCorner0 may correspond to weight index information for a first control point in each combination, bcwIdxCorner1 may correspond to weight index information for a second control point in each combination, and bcwIdxCorner2 may correspond to weight index information for a third control point in each combination.

Meanwhile, bcwIdxGroupX may be a BCW group index, and may be divided into three groups: {0}, {1, 2, 3}, and {4}. That is, bcwIdxGroupX may be divided into three groups of {(−¼, 5/4)}, {(¼, ¾), ( 2/4, 2/4), (¾, ¼)}, and {( 5/4, −¼)}.

Referring to Table 13, when three control points are used, six comparison processes may be required.

In this case, as the weight index information for the temporal candidate is set as a default value, it is possible to simplify a comparison process of bcwIdxCorner2. Therefore, weight index information for an affine merge candidate may be derived as shown in Table 14 below.

TABLE 14 if (bcwIdxCorner0 = = bcwIdxCorner1 && bcwIdxGroup0 = = bcwIdxGroup2)  bcwIdxConst = bcwIdxCorner0 else if (bcwIdxGroup0 = = bcwIdxGroup1)  bcwIdxConst = bcwIdxCorner0 else if (bcwIdxGroup1 = = bcwIdxGroup0)  bcwIdxConst = bcwIdxCorner2 else  bcwIdxConst = Default value

In addition, only three items of weight index information in the BCW group index {(¼, ¾), ( 2/4, 2/4), (¾, ¼)} may be used, and since these weight index information are mapped as only one group, a BCW group index comparison process may be simplified as shown in Table 15 below.

TABLE 15 if (bcwIdxCorner0 = = bcwIdxCorner1)  bcwIdxConst = bcwIdxCorner0 else if (bcwIdxCorner0 = = bcwIdxCorner2)  bcwIdxConst = bcwIdxCorner0 else if (bceIdxCorner1 = = bcwIdxCorner2)  bcwIdxConst = bcwIdxCorner2 else  bcwIdxConst = Default value

As described above, it is possible to simplify the process of deriving weight index information for an affine merge candidate by removing unnecessary conditions. Hereinafter, other embodiments for simplifying the process of deriving weight index information for an affine merge candidate will be described.

In one embodiment, when the affine merge candidate includes the CPMV0, weight index information for the affine merge candidate may be derived based on the weight index information for the CP0. The weight index information for the CP0 may correspond to weight index information for a block that is used for deriving the CPMV0 among the top-left neighboring block of the current block, the first top neighboring block adjacent to the right side of the top-left neighboring block, and the first left neighboring block adjacent to the bottom side of the top-left neighboring block.

Meanwhile, when the affine merge candidate does not include the CPMV0 but includes the CPMV1, weight index information for the affine merge candidate may be derived based on weight index information for the CP1. The weight index information for the CP1 may correspond to weight index information of a block that is used for deriving the CPMV1 among the top-right neighboring block of the current block or the second top neighboring block adjacent to the left side of the top-right neighboring block.

According to the above method, the weight index information for the affine merge candidate may be derived based on weight index information of a block that is used for deriving a first CPMV with respect to each of {CPMV0, CPMV1, CPMV2}, {CPMV0, CPMV1, CPMV3}, {CPMV0, CPMV2, CPMV3}, {CPMV1, CPMV2, CPMV3}, {CPMV0, CPMV1}, and {CPMV0, CPMV2}. Accordingly, weight index information for the affine merge candidate may be derived as shown in Table 16 below.

TABLE 16 bcwIdxConst = bcwIdxCorner0

According to another embodiment of deriving weight index information for an affine merge candidate, when the CPMV0 for the CP0 located on the top-left side of the current block and the CPMV1 for the CP1 located on the right of the current block are the same, the weight index information for the affine merge candidate may be derived based on the weight index information for the CP0. Meanwhile, when the CPMV0 for the CP0 located on the top-left side of the current block and the CPMV1 for the CP1 located on the top-right side of the current block are not the same, the weight index information for the affine merge candidate may be derived based on default weight index information. The default weight index information may correspond to weight index information for giving a same weight to each of the L0 prediction samples and the L1 prediction samples. Therefore, the weight index information for the affine merge candidate may be derived as shown in Table 17 below.

TABLE 17 if (bcwIdxCorner0 = = bcwIdxCorner1)  bcwIdxConst = bcwIdxCorner0 else  bcwIdxConst = Default value

According to another embodiment of deriving the weight index information on the affine merge candidate, the weight index information on the affine merge candidate may be derived as a weight index of a candidate having a high frequency of occurrence among the weight indexes of each candidate. For example, a weight index of a candidate block determined as a motion vector in CP0 among CP0 candidate blocks, a weight index of a candidate block determined as a motion vector in CP1 among CP1 candidate blocks, a weight index of a candidate block determined as a motion vector in CP2 among CP2 candidate blocks, and/or the most overlapping weight index among the weight indexes of the candidate blocks determined as the motion vector in CP3 among the CP3 candidate blocks may be derived as the weight index of the affine merge candidate.

For example, CP0 and CP1 may be used as the control point, CP0, CP1, and CP2 may be used, and CP3 may not be used. However, for example, when a CP3 candidate of an affine block (a block coded in the affine prediction mode) is to be used, the method of deriving a weight index in the temporal candidate block described in the above-described embodiments may be used.

FIGS. 15 and 16 are diagrams schematically illustrating an example of a video/image encoding method and related components according to an embodiment(s) of present disclosure.

The method disclosed in FIG. 15 may be performed by the encoding apparatus disclosed in FIG. 2 or FIG. 16. Specifically, for example, operations S1500 to S1520 of FIG. 15 may be performed by the predictor 220 of the encoding apparatus 200 of FIG. 16, operation S1530 of FIG. 15 may be performed by the residual processor 230 of the encoding apparatus 200 of FIG. 16, and operation S1540 of FIG. 15 may be performed by the entropy encoder 240 of the encoding apparatus 200 of FIG. 16. In addition, although not shown in FIG. 15, prediction samples or prediction-related information may be derived by the predictor 220 of the encoding apparatus 200 in FIG. 15, residual information may be derived from original samples or the prediction samples by the residual processor 230 of the encoding apparatus 200, and a bitstream may be generated from the residual information or the prediction-related information by the entropy encoder 240 of the encoding apparatus 200. The method disclosed in FIG. 15 may include the embodiments described above in present disclosure.

Referring to FIG. 15, the encoding apparatus may determine an inter prediction mode of a current block and generate inter prediction mode information indicating the determined inter prediction mode in operation S1500. For example, the encoding apparatus may determine a merge mode, an affine (merge) mode, or a subblock merge mode as an inter prediction mode to be applied to the current block, and generate inter prediction mode information indicating the determined merge mode. In addition, the encoding apparatus may generate inter prediction type information indicating an inter prediction type of the current block as bi-prediction. For example, the inter prediction type of the current block may be determined as bi-prediction among L0 prediction, L1 prediction, or bi-prediction, and inter prediction type information indicating the determined inter prediction type may be generated. In this case, the L0 prediction may indicate prediction based on a reference picture list 0, the L1 prediction may indicate prediction based on a reference picture list 1, and the bi-prediction may indicate prediction based on the reference picture list 0 and the reference picture list 1. For example, the encoding apparatus may generate inter prediction type information based on the inter prediction type. For example, the inter prediction type information may include an inter_pred_idc syntax element.

The encoding apparatus may generate a merge candidate list for the current block based on the inter prediction mode in operation S1510. For example, the encoding apparatus may generate a merge candidate list according to the determined inter prediction mode. In this case, when the determined inter prediction mode is an affine merge mode or a subblock merge mode, the merge candidate list may be referred to as an affine merge candidate list or a subblock merge candidate list, but may also be simply referred to as a merge candidate list.

For example, candidates may be inserted into the merge candidate list until the number of candidates in the merge candidate list becomes the maximum number of candidates. Here, the candidate may indicate a candidate or a candidate block for deriving motion information (or motion vector) of the current block. For example, the candidate block may be derived through a search for neighboring blocks of the current block. For example, a neighboring block may include a spatial neighboring block and/or a temporal neighboring block of the current block, a spatial neighboring block may be preferentially searched to derive a (spatial merge) candidate, and then a temporal neighboring block may be searched to derive a (temporal merge) candidate, and the derived candidates may be inserted into the merge candidate list. For example, when the number of candidates in the merge candidate list is less than the maximum number of candidates in the merge candidate list even after the candidates are inserted, additional candidates may be inserted. For example, additional candidates include at least one of history based merge candidate(s), pair-wise average merge candidate(s), ATMVP, and combined bi-predictive merge candidates (when the slice/tile group type of the current slice/tile group is type B) and/or a zero vector merge candidate.

Alternatively, for example, candidates may be inserted into the affine merge candidate list until the number of candidates in the affine merge candidate list becomes the maximum number of candidates. Here, the candidate may include a control point motion vector (CPMV) of the current block. Alternatively, the candidate may indicate a candidate or a candidate block for deriving the CPMV. The CPMV may indicate a motion vector at the control point (CP) of the current block. For example, the number of CPs may be 2, 3, or 4, the CP may be positioned at at least a part of top-left (or top-left corner), top-right (or top-right corner), bottom-left (or bottom-left corner), or bottom-right (or bottom-right corner) of the current block, and only one CP may exist at each position.

For example, a candidate may be derived through a search for a neighboring block (or a neighboring block of a CP of the current block) of the current block. For example, the affine merge candidate list may include at least one of an inherited affine merge candidate, a constructed affine merge candidate, and a zero motion vector candidate. For example, in the affine merge candidate list, the inherited affine merge candidate may be inserted first, and then the constructed affine merge candidate may be inserted. In addition, even though affine merge candidates constructed in the affine merge candidate list are inserted, when the number of candidates in the affine merge candidate list is smaller than the maximum number of candidates, the remainder may be filled with zero motion vector candidates. Here, the zero motion vector candidate may be referred to as a zero vector. For example, the affine merge candidate list may be a list according to an affine merge mode in which a motion vector is derived in units of samples, or may be a list according to an affine merge mode in which a motion vector is derived in units of subblocks. In this case, the affine merge candidate list may be referred to as a subblock merge candidate list, and the subblock merge candidate list may also include candidates (or SbTMVP candidates) derived from SbTMVP. For example, when the SbTMVP candidate is included in the subblock merge candidate list, it may be positioned before the inherited affine merge candidate and the constructed affine merge candidate in the subblock merge candidate list.

The encoding apparatus may generate selection information indicating one candidate from among candidates included in the merge candidate list in operation S1520. For example, the merge candidate list may include at least one of a spatial merge candidate, a temporal merge candidate, a pair-wise candidate, or a zero vector candidate, and one candidate from among these candidates may be selected for inter prediction of the current block. Alternatively, for example, the sub-block merge candidate list may include at least one of an inherited affine merge candidate, a constructed affine merge candidate, an SbTMVP candidate, or a zero vector candidate, and one candidate from among these candidates may be selected for inter prediction of the current block.

For example, the selection information may include index information indicating a selected candidate in the merge candidate list. For example, the selection information may be referred to as merge index information or subblock merge index information.

The encoding apparatus may generate residual information based on residual samples of the current block in operation S1530. For example, the encoding apparatus may derive residual samples based on the prediction samples and original samples. For example, the encoding apparatus may generate the residual information indicating quantized transform coefficients of the residual samples. The residual information may be generated through various encoding methods such as exponential Golomb, CAVLC, CABAC, and the like.

The encoding apparatus may encode the image information including inter prediction mode information, the selection information, and the residual information in operation S1540. For example, the image information may be referred to as video information. The image information may include various types of information according to the above-described embodiment(s) of present disclosure. For example, the image information may include at least one of prediction-related information or residual-related information. For example, the prediction-related information may include at least one of the inter prediction mode information, selection information, and inter prediction type information. For example, the encoding apparatus may generate a bitstream or encoded information by encoding image information including all or part of the above-described information (or syntax elements). Alternatively, the encoding apparatus may output the same in the form of a bitstream. In addition, the bitstream or encoded information may be transmitted to the decoding apparatus through a network or a storage medium.

Although not illustrated in FIG. 15, for example, the encoding apparatus may generate prediction samples of the current block. Or, for example, the encoding apparatus may generate prediction samples of the current block based on a selected candidate. Or, for example, the encoding apparatus may derive motion information based on a selected candidate and generate prediction samples of the current block based on the motion information. For example, the encoding apparatus may generate L0 prediction samples and L1 prediction samples according to bi-prediction, and may generate prediction samples of the current block based on the L0 prediction samples and the L1 prediction samples. In this case, the prediction samples of the current block may be generated from the L0 prediction samples and the L1 prediction samples using weight index information (or weight information) for bi-prediction. In this case, the weight information may be expressed based on the weight index information.

In other words, for example, the encoding apparatus may generate the L0 prediction samples and the L1 prediction samples of the current block based on the selected candidate. For example, when the inter-prediction type of the current block is determined to be bi-prediction, the reference picture list 0 and the reference picture list 1 may be used for prediction of the current block. For example, the L0 prediction samples may represent the prediction samples of the current block derived based on the reference picture list 0, and the L1 prediction samples may represent the prediction samples of the current block derived based on the reference picture list 1.

For example, the candidates may include a spatial merge candidate. For example, when the selected candidate is the spatial merge candidate, L0 motion information and L1 motion information may be derived based on the spatial merge candidate, and the L0 prediction samples and the L1 prediction samples are generated based thereon.

For example, the candidates may include a temporal merge candidate. For example, when the selected candidate is the temporal merge candidate, L0 motion information and L1 motion information may be derived based on the temporal merge candidate, and the L0 prediction samples and the L1 prediction samples are generated based thereon.

For example, the candidates may include pair-wise candidates. For example, when the selected candidate is the pair-wise candidate, the L0 motion information and the L1 motion information may be derived based on the pair-wise candidate, and the L0 prediction samples and the L1 prediction samples are generated based thereon. For example, the pair-wise candidate may be derived based on the first candidate and the second candidate in the merge candidate list.

Alternatively, for example, the merge candidate list may be a subblock merge candidate list, and an affine merge candidate, a subblock merge candidate, or an SbTMVP candidate may be selected. Here, the affine merge candidate in units of subblocks may be referred to as a subblock merge candidate.

For example, the candidates may include a subblock merge candidate. For example, when the selected candidate is the subblock merge candidate, L0 motion information and L1 motion information may be derived based on the subblock merge candidate, and the L0 prediction samples and the L1 prediction samples are generated based thereon. For example, the subblock merge candidate may include control point motion vectors (CPMVs), and the L0 prediction samples and the L1 prediction samples may be generated by performing prediction in units of subblock based on the CPMVs.

Here, the CPMV may be indicated based on one block among neighboring blocks of a control point (CP) of the current block. For example, the number of CPs may be 2, 3, or 4, the CP may be positioned at at least a part of top-left (or top-left corner), top-right (or top-right corner), bottom-left (or bottom-left corner), or bottom-right (or bottom-right corner) of the current block, and only one CP may exist at each position.

For example, the CP may be CP0 located on the top-left side of the current block. In this case, the neighboring blocks may include a top-left neighboring block of the current block, a first left neighboring block adjacent to a bottom side of the top-left neighboring block, and a top neighboring block adjacent to a right side of the top-left neighboring block. The neighboring blocks may include a block A2, a block B2, or a block B3 in FIG. 12.

Or, for example, the CP may be CP1 located on the right side of the current block. In this case, the neighboring blocks may include a top-right neighboring block of the current block and a second top neighboring block adjacent to the left side of the top-right neighboring block. Or, the neighboring blocks may include a block B0 or a block B1 in FIG. 12.

Or, for example, the CP may be CP2 located on the bottom-left side of the current block. In this case, the neighboring blocks may include a bottom-left neighboring block of the current block and a second left neighboring block adjacent to a top side of the bottom-left corner neighboring block. Or, the neighboring blocks may include a block A0 or a block A1 in FIG. 12.

Or, for example, the CP may be CP3 located on a bottom-right side of the current block. In this case, the neighboring blocks may include a col block of the current block or a bottom-right neighboring block of the col block. Here, the col block may include a block at the same position as that of the current block in a reference picture that is different from a current picture in which the current block is located. Or, the neighboring block may include a block T in FIG. 12.

Alternatively, for example, the candidates may include SbTMVP candidates. For example, when the selected candidate is the SbTMVP candidate, the L0 motion information and the L1 motion information may be derived based on the left neighboring block of the current block, and based on this, the L0 prediction samples and the L1 prediction samples may be generated. For example, the L0 prediction samples and the L1 prediction samples may be generated by performing prediction in units of subblocks.

For example, the L0 motion information may include an L0 reference picture index, an L0 motion vector, and the like, and the L1 motion information may include an L1 reference picture index, an L1 motion vector, and the like. The L0 reference picture index may include information indicating the reference picture in the reference picture list 0, and the L1 reference picture index may include information indicating the reference picture in the reference picture list 1.

For example, the encoding apparatus may generate prediction samples of the current block based on L0 prediction samples, L1 prediction samples, and weight information. For example, the weight information may be displayed based on the weight index information. The weight index information may indicate weight index information on bi-prediction. For example, the weight information may include information on a weighted average of L0 prediction samples or L1 prediction samples. That is, the weight index information may indicate index information on a weight used for the weighted average, and may generate weight index information in a procedure of generating prediction samples based on the weighted average. For example, the weight index information may include information indicating any one of three or five weights. For example, the weighted average may represent a weighted average in bi-prediction with CU-level weight (BCW) or bi-prediction with weighted average (BWA).

For example, the candidates may include a temporal merge candidate, and the weight index information on the temporal merge candidate may be represented by 0. That is, the weight index information on the temporal merge candidate may be represented by 0. Here, the weight index information of 0 may mean that the weights of each reference direction (i.e., the L0 prediction direction and the L1 prediction direction in bi-prediction) are the same. Alternatively, for example, the candidates may include a temporal merge candidate, and the weight index information may be indicated based on weight index information on a col block. That is, the weight index information on the temporal merge candidate may be indicated based on the weight index information on the col block. Here, the collocated block may include a block at the same position as the current block in a reference picture different from the current picture in which the current block is positioned.

For example, the candidates may include the pair-wise candidate, and the weight index information may be indicated based on the weight index information on one of the first candidate and the second candidate in the merge candidate list used to derive the pair-wise candidate.

For example, the candidates include a pair-wise candidate, and the pair-wise candidate may be indicated based on a first candidate and a second candidate in the merge candidate list. Alternatively, when the weight index information of each of the first candidate and the second candidate is the same each other, the weight index information on the pair-wise candidate may be indicated based on the weight index information of the first candidate. When the weight index information of each of the first candidate and the second candidate are not identical to each other, the weight index information on the pair-wise candidate may be indicated based on the default weight index information. In this case, the default weight index information may correspond to weight index information for assigning the same weight to each of the L0 prediction samples and the L1 prediction samples.

For example, the candidates include a pair-wise candidate, and the pair-wise candidate may be indicated based on a first candidate and a second candidate in the merge candidate list. Alternatively, when the weight index information of each of the first candidate and the second candidate is the same each other, the weight index information on the pair-wise candidate may be indicated based on the weight index information of the first candidate. Meanwhile, when the weight index information on each of the first candidate and the second candidate is not the same, the weight index information on the pair-wise candidate may be indicated based on the weight index information other than the default weight index information among the weight index information on each of the first candidate and the second candidate. The default weight index information may correspond to weight index information for assigning the same weight to each of the L0 prediction samples and the L1 prediction samples.

For example, the merge candidate list may be a subblock merge candidate list, and an affine merge candidate, a subblock merge candidate, or an SbTMVP candidate may be selected. Here, the affine merge candidate in units of subblocks may be referred to as a subblock merge candidate.

For example, the candidates may include an affine merge candidate, and the affine merge candidate may include at least one of CPMV0 for a control point CP0, CPMV1 for a control point CP1, and CPMV2 for a control point CP2. The CPMV0 may be derived based on a top-left neighboring block of the current block, a first left neighboring block adjacent to a bottom side of the top-left neighboring block, or a first top neighboring block adjacent to a right side of the top-left neighboring block, and the CPMV1 may be derived based on a top-right neighboring block of the current block or a second top neighboring block adjacent to a left side of the top-right neighboring block. In addition, the CPMV2 may be derived based on a bottom-left neighboring block of the current block or a second left neighboring block adjacent to a top side of the bottom-left neighboring block.

For example, when the affine merge candidate includes the CPMV0, weight index information for the affine merge candidate may be displayed based on the weight index information for the CP0. The weight index information for the CP0 may correspond to weight index information for a block that is used for deriving the CPMV0 among the top-left neighboring block, the first left neighboring block, and the first top neighboring block of the current block.

For example, when the affine merge candidate does not include the CPMV0 but includes the CPMV1, weight index information for the affine merge candidate may be displayed based on the weight index information for the CP1. The weight index information for the CP1 may correspond to weight index information for a block that is used for deriving the CPMV1 among the top-right neighboring block and the second top neighboring block of the current block.

Alternatively, for example, the candidates may include an SbTMVP candidate, and weight index information on the SbTMVP candidate may be indicated based on weight index information on a left neighboring block of the current block. That is, the weight index information on the SbTMVP candidate may be indicated based on the weight index information on the left neighboring block.

Alternatively, for example, the candidates may include the SbTMVP candidate, and weight index information on the SbTMVP candidate may be represented by 0. That is, the weight index information on the SbTMVP candidate may be represented by 0. Here, the weight index information of 0 may mean that the weights of each reference direction (i.e., the L0 prediction direction and the L1 prediction direction in bi-prediction) are the same.

Alternatively, for example, the candidates may include the SbTMVP candidate, and the weight index information may be indicated based on weight index information on a center block in a col block. That is, the weight index information on the SbTMVP candidate may be indicated based on the weight index information on the center block in the col block. Here, the col block may be positioned in the reference picture different from a current picture in which the current block is positioned and include the block derived based on the motion vector of the left neighboring block of the current block. In addition, the center block may include the bottom-right subblock among four subblocks positioned in the center of the col block.

Alternatively, for example, the candidates may include the SbTMVP candidate, and the weight index information may be indicated based on the weight index information on each of the subblocks in a col block. That is, the weight index information on the SbTMVP candidate may be indicated based on the weight index information on each of the subblocks of the col block.

For example, the encoding apparatus may generate a bitstream or encoded information by encoding image information including all or part of the above-described information (or syntax elements). Alternatively, the encoding apparatus may output the same in the form of a bitstream. In addition, the bitstream or encoded information may be transmitted to the decoding apparatus through a network or a storage medium. Alternatively, the bitstream or the encoded information may be stored in a computer-readable storage medium, and the bitstream or the encoded information may be generated by the above-described image encoding method.

FIGS. 17 and 18 are diagrams schematically illustrating an example of a video/image decoding method and related components according to embodiment(s) of present disclosure.

The method disclosed in FIG. 17 may be performed by the decoding apparatus disclosed in FIG. 3 or FIG. 18. For example, operation S1700 of FIG. 17 may be performed by the entropy decoder 310 of the decoding apparatus 300 in FIG. 18, and operation S1710 of FIG. 17 may be performed by the residual processor 320 of the decoding apparatus 300 in FIG. 18. In addition, operations S1720 to S1740 of FIG. 17 may be performed by the predictor 330 of the decoding apparatus 300 in FIG. 17, and operation S1750 of FIG. 17 may be performed by the adder 340 of the decoding apparatus 300 of FIG. 17. The method disclosed in FIG. 17 may include the embodiments described above in present disclosure.

Referring to FIG. 17, the decoding apparatus may receive image information including inter prediction mode information and residual information through a bitstream in operation S1700. For example, the image information may be referred to as video information. The image information may include various types of information according to the above-described embodiment(s) of present disclosure. For example, the image information may include at least one of prediction-related information or residual-related information.

For example, the prediction-related information may include inter prediction mode information or inter prediction type information. For example, the inter prediction mode information may include information indicating at least one of various inter prediction modes. For example, various modes such as a merge mode, a skip mode, a motion vector prediction (MVP) mode, an affine mode, a subblock merge mode, or a merge with MVD (MMVD) mode may be used. In addition, a decoder side motion vector refinement (DMVR) mode, an adaptive motion vector resolution (AMVR) mode, a bi-prediction with CU-level weight (BCW), or bi-directional optical flow (BDOF), or the like may be further used as an auxiliary mode or may be used instead. For example, the inter prediction type information may include an inter_pred_idc syntax element. Alternatively, the inter prediction type information may include information indicating any one of L0 prediction, L1 prediction, and bi-prediction.

The decoding apparatus may generate residual samples based on the residual information in operation S1710. The decoding apparatus may derive quantized transform coefficients based on the residual information and may derive residual samples based on an inverse transform procedure for the transform coefficients.

The decoding apparatus may generate a merge candidate list for the current block based on the inter prediction mode information in operation S1720. For example, the decoding apparatus may determine the inter prediction mode of the current block as a merge mode, an affine (merge) mode, or a sub-block merge mode based on the inter prediction mode information, and may generate a merge candidate list according to the determined inter prediction mode. Here, when the inter prediction mode is determined as the affine merge mode or the sub-block merge mode, the merge candidate list may be referred to as an affine merge candidate list or a sub-block merge candidate list, but may also be simply referred to as a merge candidate list.

For example, candidates may be inserted into the merge candidate list until the number of candidates in the merge candidate list becomes the maximum number of candidates. Here, the candidate may indicate a candidate or a candidate block for deriving motion information (or motion vector) of the current block. For example, the candidate block may be derived through a search for neighboring blocks of the current block. For example, a neighboring block may include a spatial neighboring block and/or a temporal neighboring block of the current block, a spatial neighboring block may be preferentially searched to derive a (spatial merge) candidate, and then a temporal neighboring block may be searched to derive a (temporal merge) candidate, and the derived candidates may be inserted into the merge candidate list. For example, when the number of candidates in the merge candidate list is less than the maximum number of candidates in the merge candidate list even after the candidates are inserted, additional candidates may be inserted. For example, additional candidates include at least one of history based merge candidate(s), pair-wise average merge candidate(s), ATMVP, and combined bi-predictive merge candidates (when the slice/tile group type of the current slice/tile group is type B) and/or a zero vector merge candidate.

Alternatively, for example, candidates may be inserted into the affine merge candidate list until the number of candidates in the affine merge candidate list becomes the maximum number of candidates. Here, the candidate may include a control point motion vector (CPMV) of the current block. Alternatively, the candidate may indicate a candidate or a candidate block for deriving the CPMV. The CPMV may indicate a motion vector at a control point (CP) of the current block. For example, the number of CPs may be 2, 3, or 4, the CP may be positioned at at least a part of top-left (or top-left corner), top-right (or top-right corner), bottom-left (or bottom-left corner), or bottom-right (or bottom-right corner) of the current block, and only one CP may exist at each position.

For example, a candidate may be derived through a search for a neighboring block (or a neighboring block of a CP of the current block) of the current block. For example, the affine merge candidate list may include at least one of an inherited affine merge candidate, a constructed affine merge candidate, and a zero motion vector candidate. For example, in the affine merge candidate list, the inherited affine merge candidate may be inserted first, and then the constructed affine merge candidate may be inserted. In addition, even though affine merge candidates constructed in the affine merge candidate list are inserted, when the number of candidates in the affine merge candidate list is smaller than the maximum number of candidates, the remainder may be filled with zero motion vector candidates. Here, the zero motion vector candidate may be referred to as a zero vector. For example, the affine merge candidate list may be a list according to an affine merge mode in which a motion vector is derived in units of samples, or may be a list according to an affine merge mode in which a motion vector is derived in units of subblocks. In this case, the affine merge candidate list may be referred to as a subblock merge candidate list, and the subblock merge candidate list may also include candidates (or SbTMVP candidates) derived from SbTMVP. For example, when the SbTMVP candidate is included in the subblock merge candidate list, it may be positioned before the inherited affine merge candidate and the constructed affine merge candidate in the subblock merge candidate list.

The decoding apparatus may generate L0 prediction samples and L1 prediction samples of the current block based on the selected candidate in operation S1730. For example, the merge candidate list may include at least one of a spatial merge candidate, a temporal merge candidate, a pair-wise candidate, or a zero vector candidate, and one candidate from among these candidates may be selected for inter prediction of the current block. Alternatively, for example, the subblock merge candidate list may include at least one of an inherited affine merge candidate, a constructed affine merge candidate, an SbTMVP candidate, or a zero vector candidate, and one candidate from among these candidates may be selected for inter prediction of the current block. For example, the selected candidate may be selected from the merge candidate list based on selection information. For example, the selection information may include index information indicating a selected candidate in the merge candidate list. For example, the selection information may be referred to as merge index information or subblock merge index information. For example, the selection information may be included in the image information. Alternatively, the selection information may be included in the inter prediction mode information.

For example, when the inter prediction type is derived as bi-prediction, the decoding apparatus may derive L0 motion information and L1 motion information based on the selected candidate. The decoding apparatus may derive the inter prediction type of the current block as bi-prediction based on the inter prediction type information. For example, the inter prediction type of the current block may be derived as bi-prediction among L0 prediction, L1 prediction, or bi-prediction based on the inter prediction type information. In this case, the L0 prediction may indicate prediction based on a reference picture list 0, the L1 prediction may indicate prediction based on a reference picture list 1, and the bi-prediction may indicate prediction based on the reference picture list 0 and the reference picture list 1. For example, the inter prediction type information may include an inter_pred_idc syntax element.

For example, the L0 motion information may include an L0 reference picture index, an L0 motion vector, and the like, and the L1 motion information may include an L1 reference picture index, an L1 motion vector, and the like. The L0 reference picture index may include information indicating the reference picture in the reference picture list 0, and the L1 reference picture index may include information indicating the reference picture in the reference picture list 1.

For example, the candidates may include a spatial merge candidate. For example, when the selected candidate is the spatial merge candidate, L0 motion information and L1 motion information may be derived based on the spatial merge candidate, and the L0 prediction samples and the L1 prediction samples are generated based thereon.

For example, the candidates may include a temporal merge candidate. For example, when the selected candidate is the temporal merge candidate, L0 motion information and L1 motion information may be derived based on the temporal merge candidate, and the L0 prediction samples and the L1 prediction samples are generated based thereon.

For example, the candidates may include pair-wise candidates. For example, when the selected candidate is the pair-wise candidate, the L0 motion information and the L1 motion information may be derived based on the pair-wise candidate, and the L0 prediction samples and the L1 prediction samples are generated based thereon. For example, the pair-wise candidate may be derived based on the first candidate and the second candidate in the merge candidate list.

Alternatively, for example, the merge candidate list may be a subblock merge candidate list, and an affine merge candidate, a subblock merge candidate, or an SbTMVP candidate may be selected. Here, the affine merge candidate in units of subblocks may be referred to as a subblock merge candidate.

For example, the candidates may include an affine merge candidate. For example, when the selected candidate is the affine merge candidate, L0 motion information and L1 motion information may be derived based on the affine merge candidate, and the L0 prediction samples and the L1 prediction samples are generated based thereon. For example, the affine merge candidate may include control point motion vectors (CPMVs), and the L0 prediction samples and the L1 prediction samples may be generated by performing prediction in units of subblock based on the CPMVs.

Here, the CPMV may be derived based on one block among neighboring blocks of a control point (CP) of the current block. For example, the number of CPs may be 2, 3, or 4, the CP may be positioned at at least a part of top-left (or top-left corner), top-right (or top-right corner), bottom-left (or bottom-left corner), or bottom-right (or bottom-right corner) of the current block, and only one CP may exist at each position.

For example, the CP may be CP0 located on the top-left side of the current block. In this case, the neighboring blocks may include a top-left neighboring block of the current block, a first left neighboring block adjacent to a bottom side of the top-left neighboring block, and a top neighboring block adjacent to a right side of the top-left neighboring block. The neighboring blocks may include a block A2, a block B2, or a block B3 in FIG. 12.

Or, for example, the CP may be CP1 located on the right side of the current block. In this case, the neighboring blocks may include a top-right neighboring block of the current block and a second top neighboring block adjacent to the left side of the top-right neighboring block. Or, the neighboring blocks may include a block B0 or a block B1 in FIG. 12.

Or, for example, the CP may be CP2 located on the bottom-left side of the current block. In this case, the neighboring blocks may include a bottom-left neighboring block of the current block and a second left neighboring block adjacent to a top side of the bottom-left corner neighboring block. Or, the neighboring blocks may include a block A0 or a block A1 in FIG. 12.

Or, for example, the CP may be CP3 located on a bottom-right side of the current block. In this case, the neighboring blocks may include a col block of the current block or a bottom-right neighboring block of the col block. Here, the col block may include a block at the same position as that of the current block in a reference picture that is different from a current picture in which the current block is located. Or, the neighboring block may include a block T in FIG. 12.

Or, for example, the candidates may include an SbTMVP candidate. For example, when a selected candidate is the SbTMVP candidate, L0 motion information and L1 motion information may be derived based on the left neighboring block of the current block and the L0 prediction samples and the L1 prediction samples may be generated based on the L0 motion information and the L1 motion information. For example, the L0 prediction samples and the L1 prediction samples may be generated by performing prediction in a sub-block unit.

The decoding apparatus may generate prediction samples by weighted averaging the L0 prediction samples and the L1 prediction samples based on weight index information for the selected candidate in operation S1740. For example, the weight information on the selected candidate may include information on a weighted average of the L0 prediction samples or L1 prediction samples. That is, the weight information on the selected candidate may indicate index information on weights used for the weighted average, and the weighted averaging may be performed based on the weighted index information. For example, the weight index information may include information indicating any one of three or five weights. For example, the weighted average may indicate a weighted average in bi-prediction with CU-level weight (BCW) or bi-prediction with weighted average (BWA).

For example, the candidates may include a temporal merge candidate, and the weight index information on the temporal merge candidate may be derived as 0. That is, the weight index information on the temporal merge candidate may be derived as 0. Here, the weight index information of 0 may mean that the weights of each reference direction (i.e., the L0 prediction direction and the L1 prediction direction in bi-prediction) are the same.

For example, the candidates may include a temporal merge candidate, and the weight index information on the temporal merge candidate may be derived based on weight index information on a col block. That is, the weight index information on the temporal merge candidate may be derived based on the weight index information on the col block. Here, the collocated block may include a block at the same position as the current block in a reference picture different from the current picture in which the current block is positioned.

For example, the candidates may include the pair-wise candidate, and the weight index information may be derived based on the weight index information on one of the first candidate and the second candidate in the merge candidate list used to derive the pair-wise candidate.

For example, the candidates include a pair-wise candidate, and the pair-wise candidate may be derived based on a first candidate and a second candidate in the merge candidate list. For example, the candidates include a pair-wise candidate, and the pair-wise candidate may be derived based on a first candidate and a second candidate in the merge candidate list. When the weight index information of each of the first candidate and the second candidate are not identical to each other, the weight index information on the pair-wise candidate may be derived based on the default weight index information. In this case, the default weight index information may correspond to weight index information for assigning the same weight to each of the L0 prediction samples and the L1 prediction samples.

For example, the candidates include a pair-wise candidate, and the pair-wise candidate may be derived based on a first candidate and a second candidate in the merge candidate list. For example, the candidates include a pair-wise candidate, and the pair-wise candidate may be derived based on a first candidate and a second candidate in the merge candidate list. Meanwhile, when the weight index information on each of the first candidate and the second candidate is not the same, the weight index information on the pair-wise candidate may be derived based on the weight index information other than the default weight index information among the weight index information on each of the first candidate and the second candidate. The default weight index information may correspond to weight index information for assigning the same weight to each of the L0 prediction samples and the L1 prediction samples.

For example, the merge candidate list may be a subblock merge candidate list, and an affine merge candidate, a subblock merge candidate, or an SbTMVP candidate may be selected. Here, the affine merge candidate in units of subblocks may be referred to as a subblock merge candidate.

For example, the candidates may include an affine merge candidate, and the affine merge candidate may include at least one of CPMV0 for a control point CP0, CPMV1 for a control point CP1, and CPMV2 for a control point CP2. The CPMV0 may be derived based on a top-left neighboring block of the current block, a first left neighboring block adjacent to a bottom side of the top-left neighboring block, or a first top neighboring block adjacent to a right side of the top-left neighboring block, and the CPMV1 may be derived based on a top-right neighboring block of the current block or a second top neighboring block adjacent to a left side of the top-right neighboring block. In addition, the CPMV2 may be derived based on a bottom-left neighboring block of the current block or a second left neighboring block adjacent to a top side of the bottom-left neighboring block.

For example, when the affine merge candidate includes the CPMV0, weight index information for the affine merge candidate may be derived based on the weight index information for the CP0. The weight index information for the CP0 may correspond to weight index information for a block that is used for deriving the CPMV0 among the top-left neighboring block, the first left neighboring block, and the first top neighboring block of the current block.

For example, when the affine merge candidate does not include the CPMV0 but includes the CPMV1, weight index information for the affine merge candidate may be derived based on the weight index information for the CP1. The weight index information for the CP1 may correspond to weight index information for a block that is used for deriving the CPMV1 among the top-right neighboring block and the second top neighboring block of the current block.

Alternatively, for example, the candidates may include an SbTMVP candidate, and weight index information on the SbTMVP candidate may be derived based on weight index information on a left neighboring block of the current block. That is, the weight index information on the SbTMVP candidate may be derived based on the weight index information on the left neighboring block.

Alternatively, for example, the candidates may include the SbTMVP candidate, and weight index information on the SbTMVP candidate may be derived as 0. That is, the weight index information on the SbTMVP candidate may be derived as 0. Here, the weight index information of 0 may mean that the weights of each reference direction (i.e., the L0 prediction direction and the L1 prediction direction in bi-prediction) are the same.

Alternatively, for example, the candidates may include the SbTMVP candidate, and the weight index information may be derived based on weight index information on a center block in a col block. That is, the weight index information on the SbTMVP candidate may be derived based on the weight index information on the center block in the col block. Here, the col block may be positioned in the reference picture different from a current picture in which the current block is positioned and include the block derived based on the motion vector of the left neighboring block of the current block. In addition, the center block may include the bottom-right subblock among four subblocks positioned in the center of the col block.

Alternatively, for example, the candidates may include the SbTMVP candidate, and the weight index information may be derived based on the weight index information on each of the subblocks in a col block. That is, the weight index information on the SbTMVP candidate may be derived based on the weight index information on each of the subblocks of the col block.

The decoding apparatus may generate reconstructed samples based on the prediction samples and the residual samples in operation S1750. For example, the decoding apparatus may generate reconstructed samples based on the prediction samples and the residual samples, and a reconstructed block and a reconstructed picture may be derived based on the reconstructed samples.

For example, the decoding apparatus may obtain image information including all or parts of the above-described pieces of information (or syntax elements) by decoding the bitstream or the encoded information. Further, the bitstream or the encoded information may be stored in a computer readable storage medium, and may cause the above-described decoding method to be performed.

Although methods have been described on the basis of a flowchart in which steps or blocks are listed in sequence in the above-described embodiments, the steps of the present document are not limited to a certain order, and a certain step may be performed in a different step or in a different order or concurrently with respect to that described above. Further, it will be understood by those ordinary skilled in the art that the steps of the flowcharts are not exclusive, and another step may be included therein or one or more steps in the flowchart may be deleted without exerting an influence on the scope of the present disclosure.

The aforementioned method according to the present disclosure may be in the form of software, and the encoding apparatus and/or decoding apparatus according to the present disclosure may be included in a device for performing image processing, for example, a TV, a computer, a smart phone, a set-top box, a display device, or the like.

When the embodiments of the present disclosure are implemented by software, the aforementioned method may be implemented by a module (process or function) which performs the aforementioned function. The module may be stored in a memory and executed by a processor. The memory may be installed inside or outside the processor and may be connected to the processor via various well-known means. The processor may include Application-Specific Integrated Circuit (ASIC), other chipsets, a logical circuit, and/or a data processing device. The memory may include a Read-Only Memory (ROM), a Random Access Memory (RAM), a flash memory, a memory card, a storage medium, and/or other storage device. In other words, the embodiments according to the present disclosure may be implemented and executed on a processor, a micro-processor, a controller, or a chip. For example, functional units illustrated in the respective figures may be implemented and executed on a computer, a processor, a microprocessor, a controller, or a chip. In this case, information on implementation (for example, information on instructions) or algorithms may be stored in a digital storage medium.

In addition, the decoding apparatus and the encoding apparatus to which the embodiment(s) of the present document is applied may be included in a multimedia broadcasting transceiver, a mobile communication terminal, a home cinema video device, a digital cinema video device, a surveillance camera, a video chat device, and a real time communication device such as video communication, a mobile streaming device, a storage medium, a camcorder, a video on demand (VoD) service provider, an Over The Top (OTT) video device, an internet streaming service provider, a 3D video device, a Virtual Reality (VR) device, an Augment Reality (AR) device, an image telephone video device, a vehicle terminal (for example, a vehicle (including an autonomous vehicle) terminal, an airplane terminal, or a ship terminal), and a medical video device; and may be used to process an image signal or data. For example, the OTT video device may include a game console, a Bluray player, an Internet-connected TV, a home theater system, a smartphone, a tablet PC, and a Digital Video Recorder (DVR).

In addition, the processing method to which the embodiment(s) of the present document is applied may be produced in the form of a program executed by a computer and may be stored in a computer-readable recording medium. Multimedia data having a data structure according to the embodiment(s) of the present document may also be stored in the computer-readable recording medium. The computer readable recording medium includes all kinds of storage devices and distributed storage devices in which computer readable data is stored. The computer-readable recording medium may include, for example, a Bluray disc (BD), a universal serial bus (USB), a ROM, a PROM, an EPROM, an EEPROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device. The computer-readable recording medium also includes media embodied in the form of a carrier wave (for example, transmission over the Internet). In addition, a bitstream generated by the encoding method may be stored in the computer-readable recording medium or transmitted through a wired or wireless communication network.

In addition, the embodiment(s) of the present document may be embodied as a computer program product based on a program code, and the program code may be executed on a computer according to the embodiment(s) of the present document. The program code may be stored on a computer-readable carrier.

FIG. 19 represents an example of a contents streaming system to which the embodiment of the present document may be applied.

Referring to FIG. 19, the content streaming system to which the embodiments of the present document is applied may generally include an encoding server, a streaming server, a web server, a media storage, a user device, and a multimedia input device.

The encoding server functions to compress to digital data the contents input from the multimedia input devices, such as the smart phone, the camera, the camcorder and the like, to generate a bitstream, and to transmit it to the streaming server. As another example, in a case where the multimedia input device, such as, the smart phone, the camera, the camcorder or the like, directly generates a bitstream, the encoding server may be omitted.

The bitstream may be generated by an encoding method or a bitstream generation method to which the embodiments of the present document is applied. And the streaming server may temporarily store the bitstream in a process of transmitting or receiving the bitstream.

The streaming server transmits multimedia data to the user equipment on the basis of a user's request through the web server, which functions as an instrument that informs a user of what service there is. When the user requests a service which the user wants, the web server transfers the request to the streaming server, and the streaming server transmits multimedia data to the user. In this regard, the contents streaming system may include a separate control server, and in this case, the control server functions to control commands/responses between respective equipment in the content streaming system.

The streaming server may receive contents from the media storage and/or the encoding server. For example, in a case the contents are received from the encoding server, the contents may be received in real time. In this case, the streaming server may store the bitstream for a predetermined period of time to provide the streaming service smoothly.

For example, the user equipment may include a mobile phone, a smart phone, a laptop computer, a digital broadcasting terminal, a personal digital assistant (PDA), a portable multimedia player (PMP), a navigation, a slate PC, a tablet PC, an ultrabook, a wearable device (e.g., a watch-type terminal (smart watch), a glass-type terminal (smart glass), a head mounted display (HMD)), a digital TV, a desktop computer, a digital signage or the like.

Each of servers in the contents streaming system may be operated as a distributed server, and in this case, data received by each server may be processed in distributed manner.

Claims in the present description can be combined in a various way. For example, technical features in method claims of the present description can be combined to be implemented or performed in an apparatus, and technical features in apparatus claims can be combined to be implemented or performed in a method. Further, technical features in method claim(s) and apparatus claim(s) can be combined to be implemented or performed in an apparatus. Further, technical features in method claim(s) and apparatus claim(s) can be combined to be implemented or performed in a method. 

What is claimed is:
 1. An image decoding method performed by a decoding apparatus, the method comprising: obtaining image information comprising inter prediction mode information and residual information through a bitstream; generating residual samples based on the residual information; generating a sub-block merge candidate list for a current block based on the inter prediction mode information; selecting one candidate from among candidates included in the sub-block merge candidate list; generating L0 prediction samples and L1 prediction samples of the current block based on the selected candidate; generating prediction samples by weighted averaging the L0 prediction samples and the L1 prediction samples based on a weight index for the selected candidate, wherein the weight index is for the weighted averaging; and generating reconstructed samples based on the prediction samples and the residual samples, wherein the sub-block merge candidate list comprises a constructed affine merge candidate, wherein the constructed affine merge candidate comprises at least one of CPMV0 for a control point CP0, CPMV1 for a control point CP1, and CPMV2 for a control point CP2, wherein the CPMV0 is derived based on a top-left neighboring block of the current block, a first left neighboring block adjacent to a bottom side of the top-left neighboring block, or a first top neighboring block adjacent to a right side of the top-left neighboring block, wherein the CPMV1 is derived based on a top-right neighboring block of the current block or a second top neighboring block adjacent to a left side of the top-right neighboring block, wherein the CPMV2 is derived based on a bottom-left neighboring block of the current block or a second left neighboring block adjacent to a top side of the bottom-left neighboring block, and wherein based on a case that the constructed affine merge candidate comprises the CPMV0, a weight index for the constructed affine merge candidate is equal to a weight index for the CP0.
 2. The image decoding method of claim 1, wherein the weight index for the CP0 corresponds to a weight index of a block that is used for deriving the CPMV0 among the top-left neighboring block, the first left neighboring block, and the first top neighboring block of the current block.
 3. The image decoding method of claim 1, wherein based on a case that the constructed affine merge candidate does not comprise the CPMV0 but comprises the CPMV1, the weight index for the constructed affine merge candidate is derived based on a weight index for the CP1.
 4. The image decoding method of claim 3, wherein the weight index for the CP1 corresponds to a weight index of a block that is used for deriving the CPMV1 among the top-right neighboring block and the second top neighboring block of the current block.
 5. The image decoding method of claim 1, wherein the candidates comprise a pair-wise candidate, and the pair-wise candidate is derived based on a first candidate and a second candidate in the merge candidate list, wherein a weight index for the pair-wise candidate is derived based on a weight index of the first candidate.
 6. The image decoding method of claim 1, wherein the candidates comprise a pair-wise candidate, and the pair-wise candidate is derived based on a first candidate and a second candidate in the merge candidate list, wherein based on a case that a weight index for the first candidate and a weight index for the second candidate are identical to each other, a weight index for the pair-wise candidate is derived based on a weight index of the first candidate, wherein based on a case that the weight index for the first candidate and the weight index for the second candidate are not same, the weight index for the pair-wise candidate is derived based on a default weight index, and wherein the default weight index corresponds to a weight index for giving a same weight to each of the L0 prediction samples and the L1 prediction samples.
 7. The image decoding method of claim 1, wherein the candidates comprise a subblock-based temporal motion vector prediction (SbTMVP) candidate, and wherein a weight index for the SbTMVP candidate is derived as
 0. 8. The image decoding method of claim 1, wherein the candidates comprise a subblock-based temporal motion vector prediction (SbTMVP) candidate, wherein a weight index for the SbTMVP candidate is derived based on weight index information for a center block in a col block, wherein the col block comprises a block which is located in a reference picture different from a current picture in which the current block is located, and which is derived based on a motion vector of a left neighboring block of the current block, and wherein the center block comprises a bottom-right subblock among four subblocks located in a center of the col block.
 9. An image encoding method performed by an encoding apparatus, the method comprising: determining an inter prediction mode of a current block and generating inter prediction mode information indicating the inter prediction mode; generating a sub-block merge candidate list for the current block based on the inter prediction mode; generating selection information indicating one candidate among candidates included in the sub-block merge candidate list; generating residual information based on residual samples of the current block; and encoding image information comprising the inter prediction mode information, the selection information, and the residual information, wherein the sub-block merge candidate list comprises a constructed affine merge candidate, wherein the constructed affine merge candidate comprises at least one of CPMV0 for a control point CP0, CPMV1 for a control point CP1, and CPMV2 for a control point CP2, wherein the CPMV0 is derived based on a top-left neighboring block of the current block, a first left neighboring block adjacent to a bottom side of the top-left neighboring block, or a first top neighboring block adjacent to a right side of the top-left neighboring block, wherein the CPMV1 is derived based on a top-right neighboring block of the current block or a second top neighboring block adjacent to a left side of the top-right neighboring block, wherein the CPMV2 is derived based on a bottom-left neighboring block of the current block or a second left neighboring block adjacent to a top side of the bottom-left neighboring block, and wherein based on a case that the constructed affine merge candidate comprises the CPMV0, a weight index for the constructed affine merge candidate is equal to a weight index for the CP0, and wherein the weight index for the constructed affine merge candidate is for a weighted averaging based on L0 prediction samples and L1 prediction samples.
 10. The image decoding method of claim 1, wherein based on a case that the constructed affine merge candidate is generated based on {CP0, CP1}, the constructed affine merge candidate comprises the CPMV0 and the weight index for the constructed affine merge candidate is equal to the weight index for the CP0.
 11. The image decoding method of claim 1, wherein based on a case that the constructed affine merge candidate is generated based on {CP1, CP2, CP3}, the constructed affine merge candidate comprises the CPMV1 without comprising the CPMV0 and the weight index for the constructed affine merge candidate is equal to the weight index for the CP1.
 12. The image encoding method of claim 9, wherein based on a case that the constructed affine merge candidate does not comprise the CPMV0 but comprises the CPMV1, the weight index for the constructed affine merge candidate is derived based on a weight index for the CP1.
 13. A non-transitory computer readable digital storage medium storing a bitstream generated by an image encoding method, the method comprising: determining an inter prediction mode of a current block and generating inter prediction mode information indicating the inter prediction mode; generating a sub-block merge candidate list for the current block based on the inter prediction mode; generating selection information indicating one candidate among candidates included in the sub-block merge candidate list; generating residual information based on residual samples of the current block; and encoding image information to generate the bitstream, wherein the image information comprises the inter prediction mode information, the selection information, and the residual information, wherein the sub-block merge candidate list comprises a constructed affine merge candidate, wherein the constructed affine merge candidate comprises at least one of CPMV0 for a control point CP0, CPMV1 for a control point CP1, and CPMV2 for a control point CP2, wherein the CPMV0 is derived based on a top-left neighboring block of the current block, a first left neighboring block adjacent to a bottom side of the top-left neighboring block, or a first top neighboring block adjacent to a right side of the top-left neighboring block, wherein the CPMV1 is derived based on a top-right neighboring block of the current block or a second top neighboring block adjacent to a left side of the top-right neighboring block, wherein the CPMV2 is derived based on a bottom-left neighboring block of the current block or a second left neighboring block adjacent to a top side of the bottom-left neighboring block, wherein based on a case that the constructed affine merge candidate comprises the CPMV0, a weight index for the constructed affine merge candidate is equal to a weight index for the CP0, and wherein the weight index for the constructed affine merge candidate is for a weighted averaging based on L0 prediction samples and L1 prediction samples.
 14. The image encoding method of claim 9, wherein based on a case that the constructed affine merge candidate is generated based on {CP0, CP1}, the constructed affine merge candidate comprises the CPMV0 and the weight index for the constructed affine merge candidate is equal to the weight index for the CP0.
 15. The image decoding method of claim 9, wherein based on a case that the constructed affine merge candidate is generated based on {CP1, CP2, CP3}, the constructed affine merge candidate comprises the CPMV1 without comprising the CPMV0 and the weight index for the constructed affine merge candidate is equal to the weight index for the CP1.
 16. The non-transitory computer readable digital storage medium of claim 13, wherein based on a case that the constructed affine merge candidate is generated based on {CP0, CP1}, the constructed affine merge candidate comprises the CPMV0 and the weight index for the constructed affine merge candidate is equal to the weight index for the CP0.
 17. The non-transitory computer readable digital storage medium of claim 13, wherein based on a case that the constructed affine merge candidate is generated based on {CP1, CP2, CP3}, the constructed affine merge candidate comprises the CPMV1 without comprising the CPMV0 and the weight index for the constructed affine merge candidate is equal to the weight index for the CP1. 